Binary Search Tree Implementation in C++
Created a Library Template Class for Binary Search Tree in C++ which provides the following functionalities-
-
Insertion-
Insertion of a new Element is based on properties of BST i.e. Element in the left subtree must me smaller than the root and the elements on the right subtree must be larger than root element. -
Deletion-
After Deletion of a node from the BST it is replaced by its Inorder Successor OR Inorder Predecessor, which total depends on the user's choice. -
Traversals-
There are 3 Types of Traversals in a Tree- PreOrder-> Root - Left - Right InOrder-> Left - Root - Right PostOrder-> Left - Right - Root It can display all three types of Traversals based on user's choice. -
Topmost Element-
It is used to show the Top element i.e. Root of the Binary Search Tree.