數據結構--二叉樹--求樹的深度的算法(樹遍歷算法的應用)

int TreeDepth(CSTree T) { if(!T) return 0; else{ h1 = TreeDepth(T->firstchild); h2 = TreeDepth(T->nextsibling); return(max(h1+1,h2)); } }
相關文章
相關標籤/搜索