Dell Technologies Interview Question

Code for the leftmost node of BST

Interview Answer

Anonymous

Jul 6, 2021

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

1