A Binary Search Tree is a fundamental data structure organized in a hierarchical tree format. It's a specific type of binary tree where each node has at most two children, referred to as the left child and the right child. The key property of a BST is that for any given node, all values in its left subtree are less than the node's value, and all values in its right subtree are greater than the node's value. This ordering allows for efficient search, insertion, and deletion operations, with an average time complexity of O(log n).
Type the value to be inserted and then press Insert
New nodes are always inserted as leaf nodes. The insertion process starts at the root and traverses
the tree by comparing the new
value with the value of the current node. If the new value is smaller, it proceeds to the left child, and if it's larger, it proceeds
to the right child. This continues until an empty spot is found where the new node can be added, maintaining
the BST property.
Type the value to be deleted and then press Delete
Deleting a node from a BST is more complex as the tree's structure must be maintained. There are three cases:
Select the drop down menu and then select the traversal type. Then select the Traverse button
Traversal is the process of visiting all nodes in
the tree in a specific order. There are three primary depth-first traversal methods
visualized in this project:
Not a BST operation, press this button to generate a new binary search tree