摘要: 顺序表的查找: 直接循环依次和目标比较就行 有序表的查找(二分查找): int search(SS *T,Type key){ int mid; int low=1; int high=T.length; while(lowdata); while(front!=rear){ BTNode *p; p=Q[++fro... 阅读全文
posted @ 2016-07-29 16:48 风雨缠舟 阅读(646) 评论(0) 推荐(0) 编辑
摘要: #include #include #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define OVERFLOW -1 #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 typedef int Status; typedef char ElemType; ty... 阅读全文
posted @ 2016-07-29 10:47 风雨缠舟 阅读(2223) 评论(0) 推荐(0) 编辑
摘要: #include #include #define ok 0 #define error 1 //链队列特点在于不仅有链的头指针和尾指针,还有组成链的每一个节点,所以结构体要设置两个 typedef struct qlnode{ int data; struct qlnode *next; }Qlnode; typedef struct { Qlnode *front;... 阅读全文
posted @ 2016-07-28 11:08 风雨缠舟 阅读(1342) 评论(0) 推荐(0) 编辑
摘要: #include #include #define ok 1 #define error 0 typedef int Status; typedef char ElemType; typedef struct node{ int data; struct node *prior; struct node *next; }Node; Node * create(Node *... 阅读全文
posted @ 2016-07-28 10:00 风雨缠舟 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 基本思想:首先,选出最小的数,放在第一个位置;然后,选出第二小的数,放在第二个位置;以此类推,直到所有的数从小到大排序 阅读全文
posted @ 2016-07-27 11:26 风雨缠舟 阅读(185) 评论(0) 推荐(0) 编辑
摘要: #include #include //二分插入排序法 void BinsertSort(int a[],int n){ int low,high,mid; int i,j,temp; for(i=0;i=high+1;j--){//high+1也要yi走,让其闲置 a[j+1]=a[j]; } a[j]=temp;... 阅读全文
posted @ 2016-07-27 10:54 风雨缠舟 阅读(1885) 评论(0) 推荐(0) 编辑
摘要: #include #include void QuikSort(int a[],int m,int n){ //第一个数作为关键字,比他大的放到他后面,比他小的放到他前面,分为两个子序列,然后对这两个子序列分别重复这个操作 int low=m; int high=n; int temp=a[low]; //开始这里我直接写成了temp=a[0]导致只要第一个数比后... 阅读全文
posted @ 2016-07-27 10:18 风雨缠舟 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #include #include #define initsize 100 #define ok 1 #define error 0 typedef int Status; typedef char ElemType; typedef struct{ ElemType *base; ElemType *top; int stacksize; }SqStack; stat... 阅读全文
posted @ 2016-07-26 16:47 风雨缠舟 阅读(620) 评论(0) 推荐(0) 编辑
摘要: #include #include #define SIZE 6 typedef int Type; //直接插入排序法 void InsertSort(Type a[],Type n){ int i,j; int temp; for(i=1;i=0)&&(temp<a[j])){//后移比当前插入的值要大的 a[j+1]=a[j]; ... 阅读全文
posted @ 2016-07-26 10:41 风雨缠舟 阅读(5307) 评论(0) 推荐(0) 编辑
摘要: //顺序表的实现:(分配一段连续地址给顺序表,像数组一样去操作) #include #include #define OK 1 #define ERROR 0 #define LIST_INIT_SIZE 100 #define INCREMENT 10 typedef int ElemType; typedef struct{ ElemType *elem;//数组指针代表存储... 阅读全文
posted @ 2016-07-25 15:05 风雨缠舟 阅读(293) 评论(0) 推荐(0) 编辑