- 博客(12)
- 收藏
- 关注
原创 一级指针、二级指针、指针和数组、指针数组总结
1.指针 指针是个变量,用于存放内存单元的地址(编号)。 2.一级指针 举例: int a=8; int* p=&a; p是一个一级指针,它存放的是变量a的地址,对p解引用得到的就是a的值。 int a[3]={1,2,3}; int* p=a; 这里的p也是一个一级指针,存放的是数组的首地址,数组名就是数组的首地址,对p解引用得到的是数组的首元素。 总结:一级指针存放的是一维数组名或者是...
2019-03-13 14:24:02
309
原创 C++实现年月日
#include using namespace std; class Date { public: int GetMonthDay(int year, int month) { int monthArray[13] = { 0, 31, 28, 30 }; if (month2&& year%4 == 0&& year%100!=0 || year%400 ...
2019-01-15 17:20:05
2241
原创 归并排序 计数排序
sort.h sort.c #include “Sort.h” //归并排序 void _MergeSort(int* a, int begin, int end, int* tmp) { if (begin >= end) return; int mid = begin + ((end - begin) >> 1); //子问题:对[begin,mid][mid,end]排...
2019-01-12 19:35:02
208
原创 直接插入排序
test.c #include<stdio.h> #include<stdlib.h> #include “Sort.h” int main() { TestInsertSort(); system("pause"); } sort.h #pragma once void PrintArray(int*a, int n) { for (int i = 0; i <...
2019-01-12 18:54:42
144
原创 希尔排序
test.c #include<stdio.h> #include<stdlib.h> #include"Sort.h" int main() { TestShellSort(); system(“pause”); return 0; } sort.h #pragma once void PrintArray(int *a, int n) { for (int i = 0...
2019-01-12 18:52:15
143
原创 冒泡排序
test.c #include<stdio.h> #include<malloc.h> #include<stdlib.h> #include"sort.h" int main() { TestBubbleSort(); system(“pause”); return 0; } sort.h #pragma once #include<stdio.h>...
2019-01-12 18:48:43
101
原创 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。
” 表示。而且你需要省略所有不影响字符串与原始二叉树之间的一对一映射关系的空括号对。 示例 1: 输入: 二叉树: [1,2,3,4] 1 / 2 3 / 4 输出: “1(2(4))(3)” 解释: 原本将是“1(2(4)())(3())”, 在你省略所有不必要的空括号对之后, 它将是“1(2(4))(3)”。 示例 2: 输入: 二叉树: [1,2,3...
2019-01-06 17:03:47
538
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人