- 博客(5)
- 收藏
- 关注
原创 归并排序
//要想归并后的数组有序,前提:归并前的两个子数组是有序的 #include #include #include using namespace std; int main() { int a[40]={0}; int b[40]={0}; int c[80]={0}; int n,m,i,j,k; while(cin>>
2017-04-26 21:42:45 102
原创 单向链表,加数
ps:没有写free函数,可能会有安全问题,想知道请找度娘。 #include #include #include #include using namespace std; struct node { int data; struct node*next;//后指针 }; int main() { struct node *head,*p
2017-04-26 20:15:57 137
转载 new 与malloc
1. malloc()函数 1.1 malloc的全称是memory allocation,中文叫动态内存分配。 原型:extern void *malloc(unsigned int num_bytes); 说明:分配长度为num_bytes字节的内存块。如果分配成功则返回指向被分配内存的指针,分配失败返回空指针NULL。当内存不再使用时,应使用free()函数将内存块释放。 1.2 voi
2017-04-26 20:03:21 91
原创 双向链表加数
ps:可能有错,请大佬指出。不考虑插头和插尾的情况。 附丑图一张 #include #include #include #include using namespace std; struct node { int data; struct node *pre;//前指针 struct node *next;//后指针 }; int mai
2017-04-26 20:01:12 143
原创 双向链表实现
#include #include #include #include using namespace std; struct node { int data; struct node *pre;//前指针 struct node *next;//后指针 }; int main() { struct node *p,*t,*head
2017-04-26 18:03:29 160
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人