二叉鏈表和二叉樹的區(qū)別 以二叉鏈表為存儲(chǔ)結(jié)構(gòu)?
以二叉鏈表為存儲(chǔ)結(jié)構(gòu)?int CountNode (BTNode *t) //節(jié)點(diǎn)總數(shù) { int num if (t == NULL) num = 0 else num = 1 CountNod
以二叉鏈表為存儲(chǔ)結(jié)構(gòu)?
int CountNode (BTNode *t) //節(jié)點(diǎn)總數(shù) { int num if (t == NULL) num = 0 else num = 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) } }