二叉树遍历前序,后序,中序都可以用递归来做。
中序:
printTree(list* root)
{
if (root)
{
printTree(root->left);
printf(" %d", left->ele);
printTree(root->right);
}
}
层序遍历二叉树如何做,书上说用队列实现,回头写段代码验证一下。
二叉树遍历前序,后序,中序都可以用递归来做。
中序:
printTree(list* root)
{
if (root)
{
printTree(root->left);
printf(" %d", left->ele);
printTree(root->right);
}
}
层序遍历二叉树如何做,书上说用队列实现,回头写段代码验证一下。