2014年5月19日

冒泡排序(算法源码)

摘要: 算法源码://BubbleSort.cpp#include using namespace std;void BubbleSort(int a[], int n){ for(int i=n-1;i>0;i--) { for(int j=0;ja[j+1]) { int tmp = a[j... 阅读全文

posted @ 2014-05-19 02:01 Acor 阅读(305) 评论(0) 推荐(0) 编辑

堆排序(源码)

摘要: 源码://HeapSort.cpp#include using namespace std;//about heap://the last leaf node is a[n-1]//the last non-leaf node is a[n/2-1];// a[i]// ... 阅读全文

posted @ 2014-05-19 01:38 Acor 阅读(494) 评论(0) 推荐(0) 编辑

快速排序(递归及非递归算法源码)

摘要: 1、 递归算法:quicksort.cpp#include using namespace std;void Swap(int a[],int i,int j){ int temp=a[i]; a[i] = a[j]; a[j] = temp;}int Partition(int a[],int l... 阅读全文

posted @ 2014-05-19 00:04 Acor 阅读(3682) 评论(0) 推荐(0) 编辑

导航