Skip to content
Tech Interview Prep home
Technical interview guide

Binary Search

Halving the search space on sorted data, and the many variants beyond a plain lookup.

Read
40 min
Practice MCQs
25
Interview QA
25
Edition
v6
Editorial status
Reviewed

Scope: Language-neutral, with library behaviour cited from CPython 3.14 bisect, the C++ standard algorithms, and java.util as of Java 21.

Interview QA

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

QA-1

If last week's incident involved searching a rotated sorted array, what would you write in the report?

QA-2

How would you reason about the monotonic-predicate formulation in a system you own?

QA-3

Walk through half-open ranges, including where engineers most often get it wrong.

QA-4

How does binary search on the answer change if the workload grows by two orders of magnitude?

QA-5

How would you review a pull request whose risk is searching a two-dimensional sorted matrix?

QA-6

A teammate proposes a design that hinges on leftmost and rightmost boundaries. How do you evaluate it?

QA-7

Where does insertion points matter, and where is it irrelevant?

QA-8

Teach counting occurrences to an engineer who has only seen it as a rule of thumb.

QA-9

Explain the halving argument and how it changes a production decision.

QA-10

How would you test a claim that the system depends on duplicates break the rotation argument?

QA-11

What would you measure before treating finding the rotation point as settled?

QA-12

What does midpoint overflow guarantee, and what does it deliberately leave open?

QA-13

A vendor promises choosing the answer range is handled for you. What do you still own?

QA-14

When would you refuse a design because of binary search on floating-point ranges?

QA-15

How would you explain the comparison function contract without using the usual slogan?

QA-16

What failure would you inject to check a team's understanding of when sorting first is not worth it?

QA-17

How should on-call treat an alert that names binary search versus hashing as the cause?

QA-18

What belongs in a runbook section on cache behaviour and interpolation search, and what does not?

QA-19

Describe termination and the evidence you would collect before relying on it.

QA-20

How would you brief product on why the logarithm's base and practical depth delays a ship date?

QA-21

What trade-off does the median of two sorted arrays force that a junior answer usually skips?

QA-22

What is the smallest experiment that would change your mind about searching over an implicit array?

QA-23

How does off-by-one testing strategy interact with rollback, and where do people ignore that?

QA-24

What would you ask a candidate who recites using the library implementation but cannot apply it?

QA-25

How would you document recognising the pattern so the next owner can operate it?