GATE DA 2026 Q31: Worst-case comparisons in binary search of 1000 elements
- Programming, Data Structures and Algorithms
- 1 mark
- NAT
- No negative marking
Question
Let be a sorted array containing 1000 distinct integers. You perform a recursive binary search on to find an element . Suppose each comparison checks whether the middle element computed during the current recursive step is equal to, less than, or greater than .
The maximum number of comparisons that may have to be performed if is not an element of is _______. (Answer in integer)
Try it: numerical answer: type the value
Show answer and explanation
Answer: 10 (official GATE 2026 final answer key)
Concept used: An unsuccessful binary search makes comparisons in the worst case.
First step: , so .
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 2026 DA question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key
More Programming, Data Structures and Algorithms PYQs
- 2026 · Q15Expected-time recurrence for randomised-input quicksort
- 2026 · Q16Python mutable default argument output
- 2026 · Q25Binary tree from preorder and inorder traversals
- 2026 · Q39Number of calls made by a Fibonacci-like recursion
- 2026 · Q40Reachability in a graph and its reverse
- 2026 · Q49Comparisons by bubble sort and insertion sort on a nearly sorted array