Question
Which searching algorithm is most suitable for a
balanced binary search tree (BST) when the goal is minimal comparison?Solution
In a balanced BST, keys are arranged such that for any node, the left subtree contains keys smaller than the node, and the right subtree contains keys larger than the node. This structure allows Binary Search to perform efficiently, as it eliminates half the search space with each comparison, achieving a time complexity of O(logn). The minimal comparisons and logical traversal make Binary Search optimal for balanced trees. Why Other Options are Incorrect: 1. Linear Search: Linear search checks each node one by one, resulting in O(n) complexity, making it highly inefficient for large datasets. 2. Depth-First Search: DFS explores nodes depth-wise, which is not directly suitable for searching in a sorted structure like BST. 3. Breadth-First Search: BFS examines nodes level-wise, increasing overhead compared to Binary Search in BST. 4. Exponential Search: This method is better suited for arrays rather than tree structures, especially when data sizes are unknown or unbounded.
A-5, A, 35, 52, 78, 115
30, 42, 48, 54, 65, 81, 126
- Find the wrong number in the given number series.
25, 34, 18, 34, 9, 46 Find the wrong number in the given number series.
32, 48, 72, 108, 162, 245
Find the wrong number in the given number series.
1600, 800, 1200, 400, 100 , 12.5
547, 594, 640, 691, 741, 792
Find the wrong number in the given number series.
26, 38, 60, 110, 206, 398
75, 450, 225, 1330, 675, 4050
Find the wrong number in the given number series.
8, 12, 23, 40, 66, 103
62, 79, 98, 119, 142, 165