第十四周 折半查詢

2021-07-25 06:09:11 字數 929 閱讀 5674

/*         

*作 者:孫子策

*完成日期:2016.12.8

*問題描述:請用(共n=25據,每塊資料個數s=5作為資料表,自行構造索引表,分別對查詢85測試。

*/
#include #define maxl 100 //資料表的最大長度

#define maxi 20 //索引表的最大長度

typedef int keytype;

typedef char infotype[10];

typedef struct

nodetype;

typedef nodetype seqlist[maxl]; //順序表型別

typedef struct

idxtype;

typedef idxtype idx[maxi]; //索引表型別

int idxsearch(idx i,int m,seqlist r,int n,keytype k)

i=i[high+1].link;

while (i<=i[high+1].link+b-1 && r[i].key!=k) i++;

if (i<=i[high+1].link+b-1)

return i+1;

else

return 0;

}

int main()

,,,,};

keytype a= ;

keytype x=85;

for (i=0; i

知識點總結和心得體會:

分塊查詢就是把最大的拿出來,單獨分成乙個組再進行查詢。

理解他的意思,但是**不是很寫的出來。

第十四周 折半查詢

檔名稱 專案1.cbp 作 者 紀冬雪 完成日期 2015年12月14日 版 本 號 v1.0 問題描述 折半查詢 輸入描述 無 程式輸出 查詢後的內容 include define maxl 100 typedef int keytype typedef char infotype 10 type...

第十四周 折半查詢

作 者 孫子策 完成日期 2016.12.1 問題描述 請用有序表作為測試序列,分別對查詢90 47 100進行測試 include define maxl 100 typedef int keytype typedef char infotype 10 typedef struct nodetyp...

第十四周專案1 驗證折半查詢

標頭檔案 ifndef graph h included define graph h included define maxv 100 最大頂點個數 define inf 32767 inf表示 typedef int infotype 以下定義鄰接矩陣型別 typedef struct vert...