GATE DA 2025 Q27: When does binary search run in O(log n)?
- Programming, Data Structures and Algorithms
- 1 mark
- MSQ
- No negative marking
Question
For which of the following inputs does binary search take time in the worst case?
Try it: multiple select: one or more correct options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation
Answer: C (official GATE 2025 final answer key)
Concept used: Binary search needs sorted input and constant-time access to the middle element.
First step: Ask two questions for each option: is the data sorted, and can you jump to the middle element in time?
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2025 DA question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Programming, Data Structures and Algorithms PYQs
- 2025 · Q18Hashing with linear probing: h(x) = 3x mod 10
- 2025 · Q23Python lists: which call gives A = [1, 2, 3, 4, 5, 6]?
- 2025 · Q29Insertion sort with exactly two swaps: possible values of x
- 2025 · Q47Python sets in a while loop: which set ends up with "this"?
- 2025 · Q58Shortest paths: which edges cannot be in G?
- 2025 · Q63Python recursion: value of f(15, 10)