折半d查找.docVIP

  • 2
  • 0
  • 约8.1千字
  • 约 8页
  • 2016-12-01 发布于湖南
  • 举报
折半d查找

/*----------------------------折半查找------------------------------*/ #includestdio.h #includestdlib.h #define EQ(a,b) ((a)==(b)) #define LT(a,b) ((a)(b)) #define LQ(a,b) ((a)=(b)) #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 #define OVERFLOW 0 #define OK 1 //定义表 typedef struct { int *elem; int length; int listsize; }SSTable; //建立空表 int InitList_Bin(SSTable ST) { ST.elem=(int*)malloc(LIST_INIT_SIZE*sizeof(int)); if(!ST.elem) exit(OVERFLOW); ST.length=0; ST.listsize=LIST_INIT_SIZE; return OK; } //折半查找函数 int Search_Bin(SSTable ST,int key) { int low,high,mid; low=

文档评论(0)

1亿VIP精品文档

相关文档