Data Structures and Algorithms (English) - 6-6 Level-order Traversal(25 分)

简介: Data Structures and Algorithms (English) - 6-6 Level-order Traversal(25 分)

题目链接:点击打开链接

题目大意:略。

解题思路:略。

AC 代码

voidLevel_order ( TreeT, void (*visit)(TreeThisNode) )
{
TreeQue[100];
inthead=0, next=0;
if(T!=NULL) Que[next++]=T;
while(head<next)
    {
if(Que[head]->Left) Que[next++]=Que[head]->Left;
if(Que[head]->Right) Que[next++]=Que[head]->Right;
visit(Que[head++]);
    }
}
目录
打赏
0
0
0
0
38
分享
相关文章
LeetCode 429. N-ary Tree Level Order Traversal
给定一个 N 叉树,返回其节点值的层序遍历。 (即从左到右,逐层遍历)。
107 0
LeetCode 429. N-ary Tree Level Order Traversal
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
241 0
Data Structures and Algorithms (English) - 7-18 Hashing - Hard Version(30 分)
Data Structures and Algorithms (English) - 6-13 Topological Sort(25 分)
Data Structures and Algorithms (English) - 6-13 Topological Sort(25 分)
126 0
Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
124 0
Data Structures and Algorithms (English) - 6-15 Iterative Mergesort(25 分)
Data Structures and Algorithms (English) - 6-15 Iterative Mergesort(25 分)
212 0
Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)
Data Structures and Algorithms (English) - 6-14 Count Connected Components(20 分)
162 0
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
Data Structures and Algorithms (English) - 7-8 File Transfer(25 分)
128 0
Data Structures and Algorithms (English) - 7-12 How Long Does It Take(25 分)
Data Structures and Algorithms (English) - 7-12 How Long Does It Take(25 分)
133 0
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
Data Structures and Algorithms (English) - 6-2 Two Stacks In One Array(20 分)
163 0
Data Structures and Algorithms (English) - 6-4 Reverse Linked List(20 分)
Data Structures and Algorithms (English) - 6-4 Reverse Linked List(20 分)
137 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等