- 博客(4)
- 收藏
- 关注
原创 原始的归并排序代码实现cpp
原始的归并排序 template <class Type> void Merge(Type a[],Type t[],int l,int mid,int r){ int i = l,j = mid+1; int k = 0; while(i<=mid&&j<=r){ if(a[i]<=a[j]){ t[k++]=a[i++]; } else {
2020-12-03 15:31:45
122
原创 希尔排序的代码实现cpp
希尔排序 template <class Type> void InsertSort(Type a[],int n,int d){//插入排序 for(int i=d;i<n;++i){ for(int j=i-d;j>=0;--j){ if(a[j]>a[j+d]){ swap(a[j],a[j+d]); } } } } template <c
2020-12-03 15:30:44
116
原创 堆排序的代码实现(大根堆\小根堆)cpp
堆排序 #define LT(a,b) ((a) < (b))//大根堆 顺序 #define RT(a,b) ((a) > (b))//小根堆 逆序 template<class Type> void HeapAdjust(Type a[],int s,int m){//调整堆 Type rc = a[s];//顶端a[s] for(int i=2*s;i<=m;i*=2){ if(RT(a[i],a[i+1])&&i<m
2020-12-03 15:28:40
298
原创 字典树(Trie)的两种基本操作代码实现cpp
存储方式: struct node{ int next[26]; int cnt;//节点出现次数 }trie[size]; 插入: void insert(struct node *trie,char *str) { int now=0; for(int i=0;str[i];++i) { int t=str[i]-'a'; ...
2020-04-05 13:51:05
205
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人