Searching
Explore how to perform searching operations within a Binary Search Tree. This lesson helps you understand the comparison process starting from the root, guide your search to left or right subtrees based on key values, and grasp the worst-case time complexity to improve your algorithmic skills for competitive programming contests.
We'll cover the following...
We'll cover the following...
Algorithm
Starting from the root, we compare the key. If the key is smaller than the root’s key, we search in the left subtree. Similarly, we search in the right subtree if the key is greater than the root’s key.
Time Complexity: In the worst case, the key could be the deepest node. So, the insertion time complexity is ...