What is the time complexity of searching in a balanced Binary Search Tree?
- A.O(1)
- B.O(log n)
- C.O(n)
- D.O(n log n)
Show answer
Answer: B. O(log n)
In a balanced BST, the height is O(log n), so search requires O(log n) comparisons.
Graduate Aptitude Test in Engineering — Computer Science
Conducted by IITs / IISc
What is the time complexity of searching in a balanced Binary Search Tree?
Answer: B. O(log n)
In a balanced BST, the height is O(log n), so search requires O(log n) comparisons.
Which sorting algorithm has the best average-case time complexity?
Answer: B. Merge Sort O(n log n)
Merge Sort consistently achieves O(n log n) time complexity in all cases (best, average, worst).
In a max-heap with n elements, what is the minimum number of comparisons needed to find the minimum element?
Answer: D. O(n)
In a max-heap, the minimum is always a leaf node. All leaves must be checked: O(n/2) ≈ O(n).
Which data structure is used internally by a recursive function?
Answer: C. Stack
Function calls use the call stack — each recursive call pushes a new frame, and returns pop frames.
Which of the following is a stable sorting algorithm?
Answer: C. Merge Sort
Merge Sort is stable — equal elements maintain their relative order. Heap Sort and Quick Sort are not stable.
There are currently 5 published GATE CS questions and 1 mock test. New questions are added regularly.
GATE CS is conducted by IITs / IISc.
Yes. Create a free account to take tests, see detailed solutions and track your progress.
Each test shows its marking scheme on the instructions screen before you start, including any negative marking for wrong answers.