国产成人毛片视频|星空传媒久草视频|欧美激情草久视频|久久久久女女|久操超碰在线播放|亚洲强奸一区二区|五月天丁香社区在线|色婷婷成人丁香网|午夜欧美6666|纯肉无码91视频

二叉樹的類型 數(shù)據(jù)結(jié)構(gòu)與算法,二叉樹交換左右子樹算法?

數(shù)據(jù)結(jié)構(gòu)與算法,二叉樹交換左右子樹算法?傳入樹的根節(jié)點(diǎn):exchangelr(&root)//根是樹的根節(jié)點(diǎn)。Void exchangelr(treenode*root){treenode*TM

數(shù)據(jù)結(jié)構(gòu)與算法,二叉樹交換左右子樹算法?

傳入樹的根節(jié)點(diǎn):exchangelr(&root)//根是樹的根節(jié)點(diǎn)。Void exchangelr(treenode*root){treenode*TMP if(root==null)return//左子樹交換exchangelr(root->left)//右子樹交換exchangelr(root->right)//當(dāng)前節(jié)點(diǎn)的左右子樹TMP=root->left root->left=root->right root->right=TMP}

數(shù)據(jù)結(jié)構(gòu)中,怎樣以二叉鏈表為存儲(chǔ)結(jié)構(gòu),分別寫出求二叉樹結(jié)點(diǎn)總數(shù)及葉子總數(shù)的算法?

intcountnode(btnode*t)//節(jié)點(diǎn)總數(shù){int numif(t==null)num=0elsenum=1 countnode(t->lch)countnode(t->rch)return(num)}void countleaf(btnode*t)//葉節(jié)點(diǎn)總數(shù){if(t!=null){if(T->lch==null&;T->rch==null)count//全局變量countleaf(T->lch)countleaf(T->rch)}