91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.77KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-02-01
  • 標(biāo)簽: 二叉樹??構(gòu)建??遍歷??

資源簡(jiǎn)介

二叉樹的先中后遍歷

資源截圖

代碼片段和文件信息

#?include?
#?include?

typedef?char?ElemType;

typedef?struct?BitNode{
ElemType?data;
struct?BitNode?*?lChild;
struct?BitNode?*?rChild;
}BitNode?*BitSortTree;

BitNode?*?creatBitSortTree(); //構(gòu)建二叉排序樹
void?traverseTree(BitSortTree); //遍歷二叉樹

int?main(void)?{

BitSortTree?bst?=?creatBitSortTree();

traverseTree(bst);

return?0;
}

BitNode?*?findPos(BitSortTree?bst?char?findElem)?{
BitNode?*?preNode?=?bst; //記錄前驅(qū)節(jié)點(diǎn)
while(bst?!=?NULL)?{
preNode?=?bst;
if(bst->data?>?findElem)?{
bst?=?bst->lChild;
}?else?{
bst?=?bst->rChild;
}
}
return?preNode;
}

BitNode?*?creatBitSortTree()?{
int?num;
printf(“輸入需要?jiǎng)?chuàng)建多少個(gè)節(jié)點(diǎn):“);
scanf(“%d“?&num);
ElemType?*?arr?=?(ElemType?*)malloc(sizeof(ElemType));
for(int?index=0;?in

評(píng)論

共有 條評(píng)論

相關(guān)資源