总结一下遇到的关于char *p、char p[]和字符串的题目: 例一:(指针的指针) 1 void getmemory(char **p) 2 { 3 p = (char *)malloc(100); //p应该是*p,因为这里是对传入的二重指针所指向的内容分配空间,而不是二重指针的地址, 4 Read More
posted @ 2019-05-07 18:52 Brickert Views(1842) Comments(0) Diggs(0)
1. markdownpad——写markdown文件,写记录和代码日志 2. vim 3. FLAC APE WAV 音频格式。 4. latex 5. Emedit 优势在于搜索比notapad快 6. notepad++ 用的比较习惯 7. beyondCompare 文本比较工具 8. Po Read More
posted @ 2019-04-26 18:55 Brickert Views(71) Comments(0) Diggs(0)
最近总结了以下排序算法: 插入排序:直接插入排序,希尔排序 交换排序:冒泡排序,快速排序(挖坑法,前后指针法,左右指针法) 选择排序:直接选择排序,堆排序 归并排序 所以想对这些排序算法再做一个对比。 一、理论值对比 (参考:https://www.cnblogs.com/angelye/p/750 Read More
posted @ 2019-04-26 18:35 Brickert Views(226) Comments(0) Diggs(0)
一、基本思想 归并排序是建立在归并操作上的一种有效的排序算法,该算法是采用分治法(divide-and-conquer)的一个非常典型的应用。(分治法将问题分(divide)成一些小的问题然后递归求解,而治(conquer)的阶段则将分的阶段得到的各答案"修补"在一起,即分而治之)。 归并排序的步骤 Read More
posted @ 2019-04-26 18:03 Brickert Views(169) Comments(0) Diggs(0)
一、直接选择排序 #include <iostream> using namespace std; void print_array(int a[], int n) { for(int i = 0; i < n; i++) cout << a[i] << " " ; cout << endl; } Read More
posted @ 2019-04-24 19:51 Brickert Views(330) Comments(0) Diggs(0)
一、冒泡排序 #include <iostream> using namespace std; void print_array(int a[], int n) { for(int i = 0; i < n; i++) cout << a[i] << " " ; cout << endl; } vo Read More
posted @ 2019-04-23 23:16 Brickert Views(336) Comments(0) Diggs(0)
插入排序的思想:每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子数组中的适当位置,直到全部记录插入完成为止。 一、直接插入排序 #include <iostream> using namespace::std; //打印 void print_array(int a[], int n) Read More
posted @ 2019-04-23 16:23 Brickert Views(286) Comments(0) Diggs(0)
昨天遇到一个很奇怪的问题,如下: 按照理论,最后*p的值应该是99,不知为什么是15了,所以今天记录用gdb调试的过程,并熟悉gdb的使用。 (调试过程参考:http://www.cnblogs.com/hankers/archive/2012/12/07/2806836.html) 开始: 1. Read More
posted @ 2019-04-20 14:24 Brickert Views(3820) Comments(0) Diggs(0)
面试被问到上述问题,所以特地总结一下: 一、new和malloc的区别。 1.new可以返回指定类型的指针,并且自动分配内存大小;malloc需要计算手动计算分配空间的大小,并且返回值需要强转为实际类型的指针。 2.malloc只会进行内存分配,不会进行初始化,所以其值是随机的;new在内存分配的同 Read More
posted @ 2019-04-15 16:10 Brickert Views(447) Comments(0) Diggs(0)
昨天看到一句话:对虚函数的调用不一定是动态联编,我的映像中一直以为虚函数就是动态联编的,所以记录下来。 一、动态联编是什么? 引自多态的概念:当不同的对象调用相同的名称的成员函数时,可能引起不同的行为(执行不同的代码),这种现象叫多态性。将函数调用链接相应函数体的代码的过程称为函数联编。在C++中, Read More
posted @ 2019-04-15 14:13 Brickert Views(3298) Comments(0) Diggs(0)