Linear and Binary Search: GATE DA Previous Year Questions

Linear and Binary Search · Programming, Data Structures and Algorithms

3 questions · asked in 3 of 3 years (2024–2026)

MCQ 1 · MSQ 1 · NAT 11-mark 2 · 2-mark 1

2024Questions per year2026

Questions 1–3 of 3

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

The maximum number of comparisons that may have to be performed if y\text{y} is not an element of AA is ________. (Answer in integer)

Q2GATE 20251 markMSQ
For which of the following inputs does binary search take time O(log⁡n)O(\log n) in the worst case?

One or more options are correct.

Q3GATE 20242 marksMCQ−0.67 if wrong
Let F(n)F(n) denote the maximum number of comparisons made while searching for an entry in a sorted array of size nn using binary search.
Which ONE of the following options is TRUE?

Keep practising

Topics in Programming, Data Structures and Algorithms

All DA topics ›