03-樹2 List Leaves (25 分)

大致思路:先找到根結點root(沒有任何結點指向它的結點),並且記錄葉子的個數,然後運用層序遍歷(根據題目要求選的),將葉結點的座標輸出,注意輸出格式。 #include<cstdio> #include<queue> using namespace std; const int maxn=20; struct TNode{ int left, right; }T[maxn]; int coun
相關文章
相關標籤/搜索