Print BST keys in the given range Java

I am getting an incorrect answer- kindly let me know where I am mistaken.

Hi @justformyntra8

Your output for pre-order traversal is not correct.
For input
21 18 2 6 14 24 12 13 3 4

The correct preorder traversal is 21 18 2 6 3 4 14 12 13 24.

thanks- that solved it