Code for the leftmost node of BST
Anonymous
If you think Logically for a Binary Tree. Leftmost always be minimum value in an Array and RightMost will be the maximum value in a given array Examples: Input : N = 5, preorder[]={ 3, 2, 1, 5, 4 } Output : Leftmost = 1, Rightmost = 5 Input : N = 3 preorder[]={ 2, 1, 3} Output : Leftmost = 1, Rightmost = 3
Check out your Company Bowl for anonymous work chats.