09 2013 档案

摘要:考虑:加上一个负数,和就会变小。int MaxarySum(int a[], int Len){ int MaxSum = 0; //保存最大值 int CurSum = 0; int HeadIndex = 0; int EndIndex = 0; int i; for (i = 0; i MaxSum) { MaxSum = CurSum; //大于MaxSum则更新MaxSum EndIndex = i; } if (CurSum MaxSum) ... 阅读全文
posted @ 2013-09-28 21:33 dingsd 阅读(193) 评论(0) 推荐(0)
摘要:利用一个辅助的顺序表来先定义栈和顺序表typedef struct _Seqlist { DataType array[MaxNum]; int len;}Seqlist,*PSeqlist;typedef struct _Stack { DataType array[MaxNum]; int len;}Stack,*PStack;入栈出栈时,都更新顺序表int PushStack(PStack sta,DataType key,PSeqlist list){ if (sta->len > MaxNum) { printf("Out of St... 阅读全文
posted @ 2013-09-24 23:03 dingsd 阅读(1123) 评论(0) 推荐(1)
摘要:先定义一个单链表结构体:typedef int DataType;typedef struct _list { DataType data; struct _list *next;}List,*PList;相关操作:1,几个基本操作PList InsHead(PList *head,DataType x) //在头部插人{ PList newNode = (List *)malloc(sizeof(List)); //直接插入 newNode->data = x; newNode->next = *head; *head = newNode; ... 阅读全文
posted @ 2013-09-17 22:14 dingsd 阅读(262) 评论(1) 推荐(0)