摘要:
1 #include "pch.h" 2 #include <iostream> 3 //计数排序,本质和桶排序一样 4 //该方法的思想是构造一个简单哈希表H(key)=key(由于对哈希表的查询等操作不作要求,这里使用简单的排解冲突方式) 5 //实际上你根本不需要构造所谓的哈希表,然后排解冲突 阅读全文
摘要:
1 #include "pch.h" 2 #include <iostream> 3 void Sort(int arr[],int lo, int mid,int hi) { 4 int i, j, k; 5 int n1 = mid - lo + 1; 6 int n2 = hi - mid; 阅读全文
摘要:
1 #include "pch.h" 2 #include <iostream> 3 void shellSort(int *a, int n) 4 { 5 int d; 6 int j; 7 int i; 8 int k; 9 int temp; 10 for (d = n / 2; d >= 1 阅读全文
摘要:
1 #include "pch.h" 2 #include <iostream> 3 void InsertionSort(int *a, int len) 4 { 5 for (int j = 1; j < len; j++) 6 { 7 int key = a[j]; //从第二个元素开始,左边 阅读全文