Given a Binary tree, print it in vertical order from left to right.
We could solve this problem by performing a breadth-first or level order traversal on the given tree.

BFS (Breadth-First Search) is one of the simplest algorithms for traversing a graph. Prim’s min-spanning-tree and Djikstra’s algorithm use similar ideas as BFS. BFS is also known as Level-order traversal because the algorithm discover all nodes at distance k from root before discovering any nodes at distance k+1.