xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

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

資源簡介

二叉樹的先中后遍歷

資源截圖

代碼片段和文件信息

#?include?
#?include?

typedef?char?ElemType;

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

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

int?main(void)?{

BitSortTree?bst?=?creatBitSortTree();

traverseTree(bst);

return?0;
}

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

BitNode?*?creatBitSortTree()?{
int?num;
printf(“輸入需要創建多少個節點:“);
scanf(“%d“?&num);
ElemType?*?arr?=?(ElemType?*)malloc(sizeof(ElemType));
for(int?index=0;?in

評論

共有 條評論