排序算法
文章平均质量分 50
johnsenxu
这个作者很懒,什么都没留下…
展开
-
快速排序
#include using namespace std; int Partition(int A[], int l, int h) { int low=l,high=h; int pivotkey = A[l]; while (low { while (A[high] >= pivotkey&&high>l) --high; A[low] = A[h原创 2012-03-16 11:41:25 · 210 阅读 · 0 评论 -
哈希排序
#include "stdafx.h" #include using namespace std; typedef struct HashNode { int data; HashNode *next; } *HashList;//散列链表的每个结点的数据结构 inline void swap(int &i,int &j) { int temp=i; i=j;原创 2012-04-01 01:30:17 · 2419 阅读 · 0 评论 -
合并排序
#include using namespace std; template void Merge(T B[],T C[],T A[],int m,int n) { int i=0,j=0,k=0; while (i { if (B[i] { A[k++]=B[i++]; } else { A[k++]=C[j++]; }原创 2012-03-16 12:20:47 · 197 阅读 · 0 评论