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

adding binary tree code and theory #24

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

surendra-sk
Copy link
Contributor

Documentation Summary:
Node Class:

Represents each node in the tree.
Each node contains an integer key and two references (left and right).
BinaryTree Class:

The main class that manages the binary tree.
Contains methods for:
Insertion: Adds nodes to the tree.
Traversal: Supports in-order, pre-order, and post-order traversals.
Search: Finds if a value exists in the tree.
Time Complexity:

Insertion: O(log n) in the average case (if the tree is balanced).
Traversal: O(n), where n is the number of nodes.
Search: O(log n) in the average case (if the tree is balanced).

OUTPUT OF THE CODE :
In-order traversal:
20 30 40 50 60 70 80

Pre-order traversal:
50 30 20 40 70 60 80

Post-order traversal:
20 40 30 60 80 70 50

Search for 60: true
Search for 90: false

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Message that will be displayed on users' first pull request

@surendra-sk
Copy link
Contributor Author

can you add the hacktoberfest-accepted label to this pr for succesfully accepted to the hacktoberfest.

Copy link
Owner

@abhishektripathi66 abhishektripathi66 left a comment

Choose a reason for hiding this comment

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

Code Changes Look Fine

@surendra-sk
Copy link
Contributor Author

issue no: #22 is solved

@abhishektripathi66 abhishektripathi66 merged commit c378783 into abhishektripathi66:master Oct 22, 2024
2 checks passed
@surendra-sk
Copy link
Contributor Author

@abhishektripathi66 this repository is not participating in the hacktoberfest so can you add the topic to your repository as hactoberfest or just add the label hactoberfest-accepted in this pr.
Thanks

@abhishektripathi66
Copy link
Owner

@surendra-sk
You can add any issues if you find as well, or any questions which you saw in interviews all can be added.

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