Multiple binary search trees can be made from a single array

Code gives preorder traversal as 4 2 3 5 6, which is also perfectly fine as it’s for a different BST with the same array elements.

@Arpan_Goswami in this question you have to build bst normally like first one is root . then small goes left and bigger right (as taught in the start)
hope its clear if yes dont forget to hit like and mark resolved :smiley:

Can you share the code for the build tree, according to me if we construct the tree like the way you said it will always be a skewed tree.

We had null pointers as -1 in the videos shown

@Arpan_Goswami yes it will become skewed if sorted array given but i think input output is acc to that only
here refer insert function in this

1 Like