软基第五次上机实验报告.pdfVIP

  • 3
  • 0
  • 约4.28千字
  • 约 4页
  • 2020-11-22 发布于天津
  • 举报
. 软基第五次上机实验报告 EX5_1 一、 程序流程 设有序序列的数据元素为: (3 , 10, 13, 17 ,40,43 ,50 , 70 ) 1)编写顺序查找函数 2 )编写二分查找函数 3)在主程序中输入关键字( 43 和 5),分别调用两种查找函数,输出结果。 数据结构描述 :二分查找 二、程序代码 : #includestdio.h #includestdlib.h #define N 20 void search_sequence(int *a,int x) { int i; for(i=0;a[i+1]!=0;i++) if (a[i]==x) {printf(Location:%d\n,i);return;} if (a[i+1]==0) printf(Can not find!\n); } void search_dichot

文档评论(0)

1亿VIP精品文档

相关文档