menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Top view o...
source image

Prodevelopertutorial

1M

read

294

img
dot

Image Credit: Prodevelopertutorial

Top view of a binary tree

  • To print the top view of a binary tree, we can apply level order traversal and vertical order traversal.
  • Level order traversal gives the nodes in the order of their occurrence in each level.
  • Vertical order traversal helps to calculate the horizontal distance of each node.
  • To get the top view, we select the first node at each horizontal distance.

Read Full Article

like

17 Likes

For uninterrupted reading, download the app