data_structures.binary_tree.diff_views_of_binary_tree¶
Problem: Given root of a binary tree, return the: 1. binary-tree-right-side-view 2. binary-tree-left-side-view 3. binary-tree-top-side-view 4. binary-tree-bottom-side-view
Classes¶
Functions¶
|
Function returns the bottom side view of binary tree |
|
Function returns the left side view of binary tree. |
|
Function returns the right side view of binary tree. |
|
Function returns the top side view of binary tree. |
|
Module Contents¶
- data_structures.binary_tree.diff_views_of_binary_tree.binary_tree_bottom_side_view(root: TreeNode) list[int] ¶
Function returns the bottom side view of binary tree
3
/
- 9 20
/
15 7
↑ ↑ ↑ ↑ 9 15 20 7
>>> binary_tree_bottom_side_view(make_tree()) [9, 15, 20, 7] >>> binary_tree_bottom_side_view(None) []
- data_structures.binary_tree.diff_views_of_binary_tree.binary_tree_left_side_view(root: TreeNode) list[int] ¶
Function returns the left side view of binary tree.
- 3 -> 3
/
- 9 -> 9 20
/
15 -> 15 7
>>> binary_tree_left_side_view(make_tree()) [3, 9, 15] >>> binary_tree_left_side_view(None) []
- data_structures.binary_tree.diff_views_of_binary_tree.binary_tree_right_side_view(root: TreeNode) list[int] ¶
Function returns the right side view of binary tree.
3 <- 3
/
- 9 20 <- 20
/
15 7 <- 7
>>> binary_tree_right_side_view(make_tree()) [3, 20, 7] >>> binary_tree_right_side_view(None) []