~~~
void swap(int *a,int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int partition(int *a,int p,int r){
int x = a[r];
int i = p-1;
for(int j=p;j<r;j++){
if(a[j]<=x){
i++;
swap(&a[i],&a[j]);
}
}
swap(&a[i+1],&a[r]);
return i+1;
}
void quickSort(int *a,int p,int r){
if(p<r){
int q = partition(a,p,r);
quickSort(a,p,q-1);
quickSort(a,q+1,r);
}
}
~~~
- 前言
- 插入排序
- 歸并排序
- 快速排序
- 最長公共子序列
- 斐波那契數列-臺階問題
- 求n*n階矩陣最大子矩陣階數
- 01背包
- 整數序列合并問題
- 動態規劃算法的一般解題思路
- 01背包-近似算法
- 樹搜索策略
- 求數組中的逆序對
- 并行機器最短調度問題
- 隨機算法
- 判斷兩多項式之積是否等于另一多項式
- 頂點覆蓋問題
- Apriori算法 (Introduction to data mining)
- 聚類算法-DBSCAN-C++實現
- 聚類算法-K-means-C++實現
- 聚類算法-Hierarchical(MIN)-C++
- 爬山法、分支限界法求解哈密頓環問題
- Best-First求解八數碼問題
- Naive Bayesian文本分類器