This code shows how to create a Binary Tree using a Menu Driven approach.
Following are the operations I have performed on Binary Trees:
- Creation of Root node
createRoot()
followed by creation of whole treecreateTree()
. It uses Recursive approach to create the tree. - Traversing the tree:
- Inorder --
inorder()
- Preorder --
preorder()
- Postorder --
postorder()
- Level-order --
levelorder()
- Inorder --
- Counting height of the tree using
height()
.
This code shows how to create a Binary Search Tree using a Menu Driven approach. I have implemented operations using both Iterative and Recurise method.
Following are the operations I have performed on Binary Search Tree:
-
Add single/multiple item(s) using
insertion_iterative()
(Iterative) andinsertion_recursive()
(Recursive). -
Search for an item using
search_iterative()
(Iterative) andsearch_recursive()
(Recursive). -
Deletion of a node using
delete()
:- Leaf node.
- Node with one subtree.
- Node with two subtree.
-
I have used
inorder()
function from the Binary Tree code mentioned above to display the Binary Search Tree.