GATE Assistant

Past questions › Data Science and Artificial Intelligence › GATE 2026

GATE 2026 · DA · NAT · 1 mark · Programming, Data Structures and Algorithms › Searching

GATE 2026 Data Science and Artificial Intelligence question: Let A be a sorted array containing 1000 distinct integers. You perform a recursive…

Let A be a sorted array containing 1000 distinct integers. You perform a recursive binary search on A to find an element y. Suppose each comparison checks whether the middle element computed during the current recursive step is equal to, less than, or greater than y.

The maximum number of comparisons that may have to be performed if y is not an element of A is _______ . (Answer in integer)

Show answer

Official answer: 10

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion