Algorithm
文章平均质量分 71
steven216
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
双链表基本操作
1.在头接点插入指定的值templatevoid InsertD(dnode* &front,const T& value){ dnode* prev = front->prev, *curr = front; dnode* newNode = new dnode(value); newNode->prev = prev; newNode->next = curr; prev->n原创 2007-01-29 17:19:00 · 679 阅读 · 0 评论 -
插入排序
int main() { int a[10] = {7,2,5,1,6,9,4,8,0,3}; for(int i = 1; i { int iKey = a[i]; int j = i - 1; while(j >= 0 && a[j] > iKey) { a[j + 1] = a[j]; --j; } a[j +1] = iKey; } f原创 2012-12-09 14:44:47 · 353 阅读 · 0 评论 -
合并排序
#include "stdafx.h" #include #include using namespace std; using namespace boost; /** * 合并两个排好的序列 * @param A * int数组 * @param p * 起始位置 * @param q * 中间位置 * @param r * 终止位置 * @param转载 2012-12-09 16:21:05 · 347 阅读 · 0 评论 -
堆排序
// Console.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include using namespace std; //array 是待调整的堆数组,i是待调整的数组元素的位置,nlength是数组的长度 //本函数功能是:根据数组array构转载 2012-12-28 10:48:57 · 372 阅读 · 0 评论 -
快速排序
//快速排序 int PARTITION(int array[],int p,int r) { int x = array[r]; int i = p - 1; for(int j = p; j { if (array[j] { ++i; swap(array[i],array[j]); } } swap(array[i + 1],array原创 2012-12-29 17:18:09 · 374 阅读 · 0 评论 -
计数排序
void counting_sort(int *ini_arr, int *sorted_arr,int n,int l) { int *count_arr = (int *)malloc(sizeof(int) * l); int i, j, k; for(k=0; k count_arr[k] = 0; for(i=0; i count_arr[ini_arr[i]]++;转载 2012-12-30 13:34:49 · 361 阅读 · 0 评论 -
桶排序
//桶排序 typedef struct node { int key; struct node * next; }KeyNode; void inc_sort(int keys[],int size,int bucket_size) { KeyNode **bucket_table=(KeyNode **)malloc(bucket_size*sizeof(KeyN转载 2012-12-30 13:35:34 · 492 阅读 · 0 评论 -
Trie 建立、插入、查找、删除操作
/* trie的节点类型 */ template //Size为字符表的大小 struct trie_node { bool terminable; //当前节点是否可以作为字符串的结尾 int node; //子节点的个数 trie_node *child[Size]; //指向子节点指针 /* 构造函数 */ trie_node() : terminable(false转载 2013-01-12 15:04:17 · 706 阅读 · 0 评论
分享