09 2019 档案
摘要:链表反转怎么也写不对。。。好烦躁啊啊啊啊,花了好多时间了,感觉要崩溃了
阅读全文
摘要:1、尾插法创建单链表 2、前插法创建单链表
阅读全文
摘要:基本操作:#include using namespace std; typedef struct LNode *List; struct LNode { int Data; List next; }; struct LNode L; int length(List PtrL)//求表长 { List p = PtrL; int j = 0; while ...
阅读全文
摘要:List Reverse(List head) { if (head == NULL || head->Next == NULL) { return head; } List p; List q; List r; p = head; q = head->Next; head->Next = NULL; whi...
阅读全文
摘要:1、用字符串记录数字 2、vector
阅读全文
摘要:1、共用体 union 可以存储不同的数据类型,但只能同时存储其中的一种类型。 共用体每次只能存储一个值。 共用体的长度是其最大的成员的长度。 2、枚举 enum创建符号常量, enum spectrum {red ,yellow,blue=8,white};//0,1,8,9 枚举量默认从0开始,
阅读全文
摘要:堆栈 #include<iostream> #define maxsize 1000 using namespace std; typedef struct SNode*Stack;//栈的顺序存储结构 struct SNode { int data[maxsize]; int top;//栈顶元素 }; void Push(Stack Ptrs, int item)//入栈 { if (Ptrs
阅读全文
摘要:线性表的数组实现 #include const int max = 1000; using namespace std; typedef struct LNode *List; struct LNode { int Data[max]; int Last; }; List MakeEmpty() { List PtrL; PtrL = (List)malloc(...
阅读全文
摘要:一种很简单的算法int MaxSub(int A[], int N) { int ThisSum, MaxSum; int i; ThisSum = 0; MaxSum = 0; for (int i = 0; i MaxSum) { MaxSum = ThisSum; } else...
阅读全文