Skip to content
GATEiit

GATE DA 2024 Q40: Recurrence for worst-case comparisons in binary search

Question

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?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2024 final answer key)

Concept used: Binary search does one comparison and then recurses into one half.

First step: In the worst case, after comparing with the middle element the search continues in a half of size about ⌊n/2⌋\lfloor n/2 \rfloor.

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

WhatsAppDownload image

Source: official GATE 2024 DA question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key