3

Print Bottom View of Binary Tree

 1 year ago
source link: https://www.geeksforgeeks.org/videos/print-bottom-view-of-binary-tree/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Print Bottom View of Binary Tree

June 19, 2023 |60 Views
Print Bottom View of Binary Tree
SDE Sheet, GFG SDE Sheet, binary-tree
 Save  Share   Like
Description
Discussion

In this video, we are given a Binary Tree, The task is to print the bottom view from left to right. 
Example:

Input:              20
                   /     \
               8         22
            /     \     /     \
         5        3  4      25
                 /    \      
             10       14
Output: 5 10 4 14 25. 
Explanation: If there are multiple bottom-most nodes for a horizontal distance from the root, then print the later one in the level traversal. 3 and 4 are both the bottom-most nodes at a horizontal distance of 0, we need to print 4. 

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/bottom-view-binary-tree/
Problem: https://practice.geeksforgeeks.org/problems/bottom-view-of-binary-tree/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK