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
相关文章
相关标签/搜索