Count binary search steps for specific keys

Quick Overview

This question evaluates understanding of binary search mechanics, counting comparisons during a specific execution, and competency in algorithmic analysis and control-flow reasoning.

Count binary search steps for specific keys

Company: Bitkernel

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Online Assessment

You have the sorted array: `[22, 34, 55, 77, 89, 93, 99, 102, 120, 140]` Using standard binary search with `low` and `high` indices and `mid = floor((low + high) / 2)`, how many comparisons are required to find each of the following keys: `77`, `34`, and `99`? Provide the triple (comparisons for 77, comparisons for 34, comparisons for 99). Options: - A. `3, 3, 3` - B. `3, 3, 4` - C. `3, 4, 3` - D. `4, 2, 4`

Quick Answer: This question evaluates understanding of binary search mechanics, counting comparisons during a specific execution, and competency in algorithmic analysis and control-flow reasoning.

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

You have the sorted array:

[22, 34, 55, 77, 89, 93, 99, 102, 120, 140]

Using standard binary search with low and high indices and mid = floor((low + high) / 2), how many comparisons are required to find each of the following keys: 77, 34, and 99?

Provide the triple (comparisons for 77, comparisons for 34, comparisons for 99).

Options:

  • A. 3, 3, 3
  • B. 3, 3, 4
  • C. 3, 4, 3
  • D. 4, 2, 4
Loading comments...