someone please explain this question
A binary search tree contains the values 1, 2, 3, 4, 5, 6, 7, 8. The tree is traversed in pre-order and the values are printed out. Which of the following sequences is a valid output?
how the option D is correct?
I think you are canfused how to create binary tree is preorder and inorder is given .
Look at the following steps
for OPTION A why not we create tree just like 2nd image .. where as you created 2nd image for option D
@abhishekmehta4u please responce
D is coorect preorder traversal as you are given bst the inorder will be sorted i.e it will be 1,2,3,4,5,6,7,8
now when you take D option than tree which is traversed for preorder will be