HeapSort自己yy-未完成
2016-12-08 22:37
211 查看
#include <iostream> #include <cstdio> using namespace std; const int maxn=1e5+7; int a[maxn]; int HeapSize; int n; //原子操作 //不要总想着搞一个大新闻,一次操作干太多操作 //只要不符合堆的性质我们就交换 void Heapify(){ int id=1; while(id<=HeapSize){ int lson=2*id; int rson=2*id+1; int t; if(lson>Heapsize&&rson>Heapsize){ break; } if(rson>HeapSize){ t=lson; } else if(a[lson]<a[rson]){ t=lson; } else{ t=rson; } if(a[t]<a[id]){ swap(a[t],a[id]); } id=t; } } void MakeHeap(){ } void HeapSort(){ } int main(){ scanf("%d",&n); HeapSize=n; int i; for(i=1;i<=n;++i){ scanf("%d",&a[i]); } return 0; }
相关文章推荐
- ADC0832的C程序(我怎么感觉网上的各种坑爹,还是自己YY了一个)
- 自己动手写一个简单正则表达式解析器(待续,未完成)
- 【自己的小玩具程序】化学方程式配平【测试中】【未完成】
- 自己yy的中缀表达式转后缀表达式(未验证完全正确)
- YY一下十年后的自己
- 图片加载未完成时的默认背景图处理(仅限自己封装的图片加载工具)
- 自己总结的Android studio 使用快捷键及注意事项(未完成版)
- 自己yy的fulkson最大流算法
- 自己yy的Splay
- 自己动手写Android Widget —— DoingWidget(未完成版)
- 面试题六(自己yy的)
- DBA 路途遥远,自己YY一下了……zz FROM: 百度百科
- android 编译自己的ROM(未完成)
- 【BZOJ2127】happiness 最小割 自己YY出来的建图、
- 自己总结的Dijkstra算法(未完成)
- POJ 3461 Oulipo(自己YY的模式匹配算法)
- TensorFlow学习笔记(八) 如何训练自己的图片模型-基于inception模型(未完成)使用迁移学习和从头学习
- 写了1个相当猥琐的小程序,··能把自己的照片贴在MM胸部,YY专用。
- YY一下十年后的自己(转)
- 自己总结的排序算法未完成