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)
…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)