Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Level Order Traversal of Binary Tree #1554

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

Arghya-Chakraborty0812
Copy link
Contributor

@Arghya-Chakraborty0812 Arghya-Chakraborty0812 commented Nov 1, 2024

Fixes#1466
Level order Traversal of Binary tree.
Algorithm:

  1. Build Tree: Starting with the root node, ask the user to input values for each node.
    • For each node, take user input to determine its left and right children.
    • If the input is -1, that child is considered NULL (no node).
  2. Level Order Traversal:
    • Initialize a queue to hold nodes at each level.
    • For each node in the queue:
      • Print the node’s value.
      • Add its left and right children to the queue (if they exist).
    • Each level is printed on a new line.
      Please review and merge my PR with appropriate tags.
      Thanks

Copy link
Collaborator

@pankaj-bind pankaj-bind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{86470825-F78E-4037-BABC-5951DB2F167A}
delete middle program file

@Arghya-Chakraborty0812
Copy link
Contributor Author

@pankaj-bind Changes done

@pankaj-bind pankaj-bind merged commit 435562b into AlgoGenesis:main Nov 4, 2024
1 of 2 checks passed
@pankaj-bind
Copy link
Collaborator

#1466

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants