先序遍历
void preorder(node* root)
{
if(root == NULL) return;
printf("%d\n", root->data);
preorder(root->lchild);
preorder(root->rchild);
}
中序遍历
void inorder(node* root)
{
if(root == NULL) return;
inorder(root->lchild);
printf("%d\n", root->data);
inorder(root->rchild);
}
后序遍历
void postorder(node* root)
{
if(root == NULL) return;
postorder(root->lchild);
postorder(root->rchild);
printf("%d\n", root->data);
}