markandey007 / DSA_CODES

follow must before pr then i will check and merge ur pr
14 stars 84 forks source link

Create Vertical order traversal of Binary Tree such that nodes are so… #12

Closed Sarthakpanwar113 closed 2 years ago

Sarthakpanwar113 commented 2 years ago

…rted individually

In this problem, if there are 2 nodes on the same vertical and on the same level then it is required to print from left to right, but this problem requires printing it in the sorted order. For that, take queue and map which consists of pair of integer and multiset to store multiple nodes that can have the same value as well. Time Complexity: O(NlogNlogN*logN) Auxiliary Space: O(N)