Given the below binary tree, answer the following questions:
- Give the output of the $$\texttt{inorder}$$, $$\texttt{preorder}$$, $$\texttt{postorder}$$ and $$\texttt{level order}$$ traversals of the above tree?
- Is the above tree a binary search tree? Justify.
- Draw a binary search tree containing the following values {2, 10, 98, 11, 6, 90, 55, 43, 12, 77, 22, 56, 44, 61, 0, 3, 100} so that its depth is equal to 5.
Difficulty level
This exercise is mostly suitable for students
Inorder: 10 20 25 30 40 45 50 60 65 75 80 85
Preorder: 50 25 20 10 40 30 45 75 60 65 80 85
Postorder: 10 20 30 45 40 25 65 60 85 80 75 50
Level order: 50 25 75 20 40 60 80 10 30 45 65 85
Yes, inorder traversal produces sorted list
Many possible solutions
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Print unique elements of an array