|
| 1 | +# Binary Trees |
| 2 | + |
| 3 | +## 1. Binary Tree: |
| 4 | + |
| 5 | +This [code](BinaryTree.py) shows how to create a Binary Tree using a Menu Driven approach. |
| 6 | + |
| 7 | +Following are the operations I have performed on Binary Trees: |
| 8 | + |
| 9 | +- Creation of Root node `createRoot()` followed by creation of whole tree `createTree()`. It uses **Recursive** approach to create the tree. |
| 10 | +- Traversing the tree: |
| 11 | + 1. Inorder -- `inorder()` |
| 12 | + 2. Preorder -- `preorder()` |
| 13 | + 3. Postorder -- `postorder()` |
| 14 | + 4. Level-order -- `levelorder()` |
| 15 | +- Counting height of the tree using `height()`. |
| 16 | + |
| 17 | +## 2. Binary Search Tree: |
| 18 | + |
| 19 | +This [code](BinarySearchTree.py) shows how to create a Binary Search Tree using a Menu Driven approach. I have implemented operations using both Iterative and Recurise method. |
| 20 | + |
| 21 | +Following are the operations I have performed on Binary Search Tree: |
| 22 | + |
| 23 | +- Add single/multiple item(s) using `insertion_iterative()` (Iterative) and `insertion_recursive()` (Recursive). |
| 24 | + |
| 25 | +- Search for an item using `search_iterative()` (Iterative) and `search_recursive()` (Recursive). |
| 26 | + |
| 27 | +- Deletion of a node using `delete()`: |
| 28 | + 1. Leaf node. |
| 29 | + 2. Node with one subtree. |
| 30 | + 3. Node with two subtree. |
| 31 | + |
| 32 | +- I have used `inorder()` function from the Binary Tree code mentioned above to display the Binary Search Tree. |
0 commit comments