Preorder postorder traversal binary tree
Answers
Answered by
1
Preorder traversal
Visit root node
Visit all the nodes in the left subtree
Visit all the nodes in the right subtree
display(root->data)
preorder(root->left)
preorder(root->right)
Postorder traversal
Visit all the nodes in the left subtree
Visit the root node
Visit all the nodes in the right subtree
postorder(root->left)
postorder(root->right)
display(root->data)
Visit root node
Visit all the nodes in the left subtree
Visit all the nodes in the right subtree
display(root->data)
preorder(root->left)
preorder(root->right)
Postorder traversal
Visit all the nodes in the left subtree
Visit the root node
Visit all the nodes in the right subtree
postorder(root->left)
postorder(root->right)
display(root->data)
Similar questions
Business Studies,
8 months ago
Biology,
8 months ago
Computer Science,
8 months ago
History,
1 year ago
Geography,
1 year ago