Algorithm Assignment
Algorithm Assignment
Assignment Question
Implement a C++ program to create a Binary Search Tree class. The class should have the
following functionalities:
1. Insertion of elements into the BST.
2. Deletion of elements from the BST.
3. Searching for an element in the BST.
4. Traversal methods to visit all elements in the BST (preorder, inorder, and postorder).
5. A method to determine the height of the BST.
Build a Binary Search Tree by inserting the following elements into an empty BST: 25, 15, 50,
10, 22, 35, 70, 4, 12, 18, 24, 31, 44, 66, 90. Show the result using in-order traversing.
Discuss two advantages of using a Binary Search Tree compared to other data structures for
searching and sorting operations. Provide examples where a Binary Search Tree would be a
suitable choice over other alternatives.
Explain the concept of a self-balancing binary search tree. Discuss one type of self-balancing
Binary Search Tree and describe how it maintains balance during insertions and deletions.
Identify and discuss a potential limitation of binary search trees. Explain a scenario where this