Skip to content

Latest commit

 

History

History

BinaryTrees

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Binary Trees

1. Binary Tree:

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 tree createTree(). It uses Recursive approach to create the tree.
  • Traversing the tree:
    1. Inorder -- inorder()
    2. Preorder -- preorder()
    3. Postorder -- postorder()
    4. Level-order -- levelorder()
  • Counting height of the tree using height().

2. Binary Search Tree:

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) and insertion_recursive() (Recursive).

  • Search for an item using search_iterative() (Iterative) and search_recursive() (Recursive).

  • Deletion of a node using delete():

    1. Leaf node.
    2. Node with one subtree.
    3. Node with two subtree.
  • I have used inorder() function from the Binary Tree code mentioned above to display the Binary Search Tree.