?? algo9-4.c
字號:
/* algo9-4.c 檢驗bo9-2.c的程序 */
#include"c1.h"
#define N 10 /* 數據元素個數 */
typedef int KeyType; /* 設關鍵字域為整型 */
typedef struct
{
KeyType key;
int others;
} ElemType; /* 數據元素類型 */
#include"c9.h"
#include"bo9-2.c"
void print(ElemType c)
{
printf("(%d,%d) ",c.key,c.others);
}
void main()
{
BiTree dt,p;
int i;
KeyType j;
ElemType r[N]={{45,1},{12,2},{53,3},{3,4},{37,5},{24,6},{100,7},{61,8},{90,9},{78,10}}; /* 以教科書圖9.7(a)為例 */
InitDSTable(&dt); /* 構造空表 */
for(i=0;i<N;i++)
InsertBST(&dt,r[i]); /* 依次插入數據元素 */
TraverseDSTable(dt,print);
printf("\n請輸入待查找的值: ");
scanf("%d",&j);
p=SearchBST(dt,j);
if(p)
{
printf("表中存在此值。");
DeleteBST(&dt,j);
printf("刪除此值后:\n");
TraverseDSTable(dt,print);
printf("\n");
}
else
printf("表中不存在此值\n");
DestroyDSTable(&dt);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -