查找排序总结

查找排序总结

ID:47847590

大小:81.00 KB

页数:11页

时间:2019-11-26

查找排序总结_第1页
查找排序总结_第2页
查找排序总结_第3页
查找排序总结_第4页
查找排序总结_第5页
资源描述:

《查找排序总结》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、总结:几种常见的查找算法^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^^1^//静态查找——顺序查找^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x^x斗、斗、斗、斗、斗、斗、斗、斗、

2、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、斗、^

3、S^y%^

4、S^y%^

5、S^y%^

6、S^

7、S〃静态查找一一索引顺序表,效果比顺序表查找较好,但远不及折半查找^l>^l>^l>^l>^l>^l>^l>吓J〃静态查找一一折半查找#include"stdio.h"^defineSIZE11intBsearch(intnum[SIZE],intnumber,int1ow,inthigh){i

8、ntmid;while(low<=high){mid二(1ow+high)/2;if(number二二num[mid])returnmid;elseif(number>num[mid])low=mid+l;elsehigh=mid-l;}return0;}main(){intnum[SIZE],number,index,i;for(i=l;i

9、x=0)printf(,znotfind!");elseprintf(/,location:%d,z,index);getchO;}■!"■!"■!"■!"■!"■!"■!"■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“■!“rjrJrJ夕iJrJ"T**7・^

10、lx^lx^lx^lx^lx^lxvx〃静态查找一一次优查找树^include"stdio.h〃#inelude"stdlib.h〃Jtincludez,math・h〃#include"conio.h"^defineSIZE11structNode{intnum;intweight;structNode*lchild,*rchild;};typedefstruct{intnum[S!ZE];intweight[SIZE];}NUM;Pratition(NUM*array,intlow,inthigh){array->num[0]=array->num[low];array->we

11、ight[0]=array->weight[low];whi1e(lowarray-〉num[0])--high;{array->num[low]=array->num[high];arrav_>weight[1ow]二array->weight[high];}while(1ownum[high]=array->num[low];arrav_>weight[high]二array->weight[1

12、ow];}}array->num[low]=array->num[0];array->weight[low]=array->weight[0];returnlow;}Sort(NUM^array,intlow,inthigh){intmid;if(1ow

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。