Detect impossible binary search comparison sequence

Quick Overview

This question evaluates understanding of binary search behavior and algorithmic reasoning about comparison order, search-space elimination, and invariants in sorted arrays.

Detect impossible binary search comparison sequence

Company: Bitkernel

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Online Assessment

Consider binary search on a sorted array of numeric keys. The following options list possible sequences of key values that the algorithm might compare against the search target (in order of comparisons). Assume the keys `180`, `200`, `450`, and `500` are in the array and are ordered so that `180 < 200 < 450 < 500`. Which of the following **cannot** be a sequence of keys compared during a single run of binary search (for some target value) on some sorted array? Options: - A. `500, 200, 450, 180` - B. `500, 450, 200, 180` - C. `180, 500, 200, 450` - D. `180, 200, 500, 450`

Quick Answer: This question evaluates understanding of binary search behavior and algorithmic reasoning about comparison order, search-space elimination, and invariants in sorted arrays.

|Home/Software Engineering Fundamentals/Bitkernel
Bitkernel logo
Bitkernel
Oct 24, 2025
mediumSoftware EngineerOnline AssessmentSoftware Engineering Fundamentals
4
0

Consider binary search on a sorted array of numeric keys. The following options list possible sequences of key values that the algorithm might compare against the search target (in order of comparisons).

Assume the keys 180, 200, 450, and 500 are in the array and are ordered so that 180 < 200 < 450 < 500.

Which of the following cannot be a sequence of keys compared during a single run of binary search (for some target value) on some sorted array?

Options:

  • A. 500, 200, 450, 180
  • B. 500, 450, 200, 180
  • C. 180, 500, 200, 450
  • D. 180, 200, 500, 450
Loading comments...