-
Notifications
You must be signed in to change notification settings - Fork 29
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
adding binary tree code and theory #24
Conversation
There was a problem hiding this 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
can you add the hacktoberfest-accepted label to this pr for succesfully accepted to the hacktoberfest. |
There was a problem hiding this 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
issue no: #22 is solved |
c378783
into
abhishektripathi66:master
@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. |
@surendra-sk |
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