Python
Python copied to clipboard
[Binary Tree] I have added the solution for different views of binary tree.
Feature description
Problem: Given root of binary Tree, print the
binary-tree-right-side-view binary-tree-left-side-view binary-tree-top-side-view binary-tree-bottom-side-view
1. binary-tree-right-side-view
3 <- 3
/ \
9 20 <- 20
/ \
15 7 <- 7
Output: [3, 20, 7]
2. binary-tree-left-side-view
3 -> 3
/ \
9 -> 9 20
/ \
15 -> 15 7
Output: [3, 9, 15]
3. binary-tree-top-side-view
9 3 20 7
⬇ ⬇ ⬇ ⬇
3
/ \
9 20
/ \
15 7
Output: [9, 3, 20, 7]
4. binary-tree-bottom-side-view
3
/ \
9 20
/ \
15 7
↑ ↑ ↑ ↑
9 15 20 7
Output: [9, 15, 20, 7]
Would you like to work on this feature?
- [X] Yes, I want to work on this feature!
PR #6965 Added
Hello Sir, Can you please assign this issue to me as I have studied DataStructures in last sem and this would be like a practice for me.
See https://github.com/TheAlgorithms/Python/issues/6981#issuecomment-1274490860
Hello @kondekarshubham123. Can you please assign this issue to me.
Hello Sir , I would like to do this job could you assign me this task.
Can You assign this to me?
Code already present in repo https://github.com/kondekarshubham123/Python/blob/cc10b20beb8f0b10b50c84bd523bf41095fe9f37/data_structures/binary_tree/binary_tree_traversals.py#L61