Skip to content

[Binary Tree] I have added the solution for different views of binary tree. #6980

@kondekarshubham123

Description

@kondekarshubham123

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?

  • Yes, I want to work on this feature!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions