Problem1417--Level-order Traversal

1417: Level-order Traversal

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

Write a routine to list out the nodes of a binary tree in

Input

where void (*visit)(Tree ThisNode) is a function that handles ThisNode being visited by Level_order, and Tree is defined as the following: typedef struct TreeNode *Tree; struct TreeNode { ElementType Element; Tree Left; Tree Right; };

Output

where void (*visit)(Tree ThisNode) is a function that handles ThisNode being visited by Level_order, and Tree is defined as the following: typedef struct TreeNode *Tree; struct TreeNode { ElementType Element; Tree Left; Tree Right; };

Sample Input Copy

图1

Sample Output Copy

Level-order: 3 5 6 1 8 10 9

Source/Category