Tree : Generate the Top- View of BST

Following the previous post on BF traversal of BSTrees, here is another cool problem often can be easily described using two different data structures. A dictionary and a Tree at play. Please read along ..


A node x is there in output if x is the topmost node at its horizontal distance. Horizontal distance of left child of…