Print Bottom View of Binary Tree
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.
Print Bottom View of Binary Tree
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/
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK