?? 習題-48.c
字號:
//本程序只給出了算法思想
//讀者可以自己完善本程序
int maxh;
Status Printpath_MaxdepthS1(Bitree T)//求深度等于樹高度減一的最靠左的結點
{
Bitree pathd;
maxh=Get_Depth(T); //Get_Depth函數見6.44
if(maxh<2)
return ERROR; //無符合條件結點
Find_h(T,1);
return OK;
}//Printpath_MaxdepthS1
void Find_h(Bitree T,int h)//尋找深度為maxh-1的結點
{
path[h]=T;
if(h==maxh-1)
{
for(i=1;path[i];i++)
printf("%c",path[i]->data);
exit; //打印輸出路徑
}
else
{
if(T->lchild)
Find_h(T->lchild,h+1);
if(T->rchild)
Find_h(T->rchild,h+1);
}
path[h]=NULL; //回溯
}//Find_h
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -