posts - 189,comments - 1,views - 10万
02 2017 档案
计数排序(不基于比较的排序算法)
摘要:1 #include 2 using namespace std; 3 4 5 void Counting_Sort(int a[], int b[], int n, int k) 6 { 7 int *c = new int[k]; 8 for (int i = 0; i = 1; j--) 15 { 16 int u = a[j];... 阅读全文
posted @ 2017-02-28 18:19 郑哲 阅读(246) 评论(0) 推荐(0) 编辑
快排序
摘要:1 #include 2 using namespace std; 3 4 5 6 int Partition(int a[],int p,int r,int q)//实现划分 7 { 8 int x = a[r]; 9 int i = p - 1; 10 for (int j = p; j <= r - 1; j++) 11 if... 阅读全文
posted @ 2017-02-28 16:10 郑哲 阅读(121) 评论(0) 推荐(0) 编辑
堆用作优先队列
摘要:1 #include 2 using namespace std; 3 4 //把a[i]中的数值增加到新的值key 5 void Heap_Increase_Key(int a[], int i, int key) 6 { 7 if (key 1&&a[i/2]<a[i]) 11 { 12 int t = a[i]; 13 a[i... 阅读全文
posted @ 2017-02-28 15:58 郑哲 阅读(118) 评论(0) 推荐(0) 编辑
堆排序
摘要:1 #include 2 using namespace std; 3 4 5 void Max_Heapify(int a[],int heap_size, int i)//修复堆 6 { 7 int largest; 8 int l = 2 * i; 9 int r = 2 * i + 1; 10 if (l a[i]) 11 ... 阅读全文
posted @ 2017-02-28 15:32 郑哲 阅读(102) 评论(0) 推荐(0) 编辑
合并算法
摘要:1 #include 2 using namespace std; 3 4 5 void Merge(int a[],int a1,int n1, int b[],int b1,int n2, int c[]) 6 { 7 int i = a1; 8 int j = b1; 9 int k = a1; 10 while (i n1) 25 ... 阅读全文
posted @ 2017-02-28 12:39 郑哲 阅读(167) 评论(0) 推荐(0) 编辑
插入排序
摘要:1 #include 2 using namespace std; 3 4 5 void Insertion_Sort(int a[],int n) 6 { 7 if (n == 1) 8 exit(1); 9 for (int k = 1; k = 0 && a[j] > x) 14 { 15 a[j... 阅读全文
posted @ 2017-02-27 22:38 郑哲 阅读(86) 评论(0) 推荐(0) 编辑
二元搜索算法(分治法)
摘要:1 #include 2 using namespace std; 3 4 5 int Binary_search(int *a, int p, int r, int x) 6 { 7 if (p > r) 8 return false; 9 int midpoint = (p + r) / 2; 10 if (a[midpoint]... 阅读全文
posted @ 2017-02-27 22:16 郑哲 阅读(355) 评论(0) 推荐(0) 编辑
循环队列(弥补队列顺序储存的不足)
摘要:1 #include 2 #include 3 using namespace std; 4 5 #define MAXSIZE 10 6 struct quene 7 { 8 int count; 9 int number[MAXSIZE]; 10 int front; 11 int end; 12 }; 13 14 15 void in... 阅读全文
posted @ 2017-02-25 11:01 郑哲 阅读(185) 评论(0) 推荐(0) 编辑
队列的顺序储存
摘要:1 #include 2 #include 3 using namespace std; 4 5 #define MAXSIZE 10 6 struct quene 7 { 8 int count; 9 int number[MAXSIZE]; 10 int front; 11 int end; 12 }; 13 14 15 void in... 阅读全文
posted @ 2017-02-25 10:52 郑哲 阅读(148) 评论(0) 推荐(0) 编辑
队列链式结构
摘要:#include<iostream>#include<ctime>using namespace std; struct node{ int number; node *next;}; struct quene{ int count; node *front; node *end;}; void i 阅读全文
posted @ 2017-02-25 10:25 郑哲 阅读(169) 评论(0) 推荐(0) 编辑
链栈
摘要:1 #include 2 #include 3 using namespace std; 4 5 struct linknode 6 { 7 int number; 8 linknode *next; 9 }; 10 11 12 struct linkstack 13 { 14 int count; 15 linknode *top; 16... 阅读全文
posted @ 2017-02-24 13:29 郑哲 阅读(101) 评论(0) 推荐(0) 编辑
两栈共享空间
摘要:1 #define MAXSIZE 100 2 3 struct doublestack 4 { 5 int number[MAXSIZE]; 6 int top1=-1; 7 int top2=MAXSIZE; 8 }; 9 10 11 void Push(doublestack *s, int e, int n) 12 { 13 //栈... 阅读全文
posted @ 2017-02-24 13:03 郑哲 阅读(139) 评论(0) 推荐(0) 编辑
栈的顺序结构
摘要:1 #include 2 #include 3 using namespace std; 4 5 #define MAXSIZE 10 6 7 struct stack 8 { 9 int number[MAXSIZE]; 10 int top=-1; 11 }; 12 13 bool Push(stack *s, int e) 14 { 15 i... 阅读全文
posted @ 2017-02-24 11:15 郑哲 阅读(134) 评论(0) 推荐(0) 编辑
双向链表的简单实现
摘要:1 #include<iostream> 2 #include<ctime> 3 using namespace std; 4 5 struct list 6 { 7 int number; 8 list *prior; 9 list *next; 10 }; 11 12 13 int FindLi 阅读全文
posted @ 2017-02-24 10:38 郑哲 阅读(100) 评论(0) 推荐(0) 编辑
单向链表的实现
摘要:#include<iostream>#include<ctime>using namespace std; struct list{ int number; list *next;}; int FindLinkList(list *t, int i){ int j = 0; list *p = t; 阅读全文
posted @ 2017-02-23 20:25 郑哲 阅读(108) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示