实践性考核实验.pptVIP

  • 1
  • 0
  • 约6.44千字
  • 约 39页
  • 2019-10-16 发布于河南
  • 举报
过程性考核实验 程序运行结果 //结构体定义 #define maxsize 10 typedef int datatype; typedef struct record { datatype key; char otherinfo; }record; //顺序查找 int seqsearch(record *r, int n, datatype key,int count ) { int i=n ; r[0].key=key; while(r[i].key!=key ){i--; count++;} count++; return i; } //二分查找 int binsearch(record *r, int n, datatype key,int count ) { int mid, low=1, high=n; while(low=high ) { mid=(low+high)/2; count++; if(r[mid].key==key ) return mid; else if(r[mid].keykey) high = mid-1; else low=mid+1; } return 0; } //ma

文档评论(0)

1亿VIP精品文档

相关文档