Intermediate Data Structures & Algorithms
Q80 / 100

Why is binary search not directly applicable to a singly linked list even though the list is sorted?

Correct! Well done.

Incorrect.

The correct answer is B) Binary search needs O(1) random access to jump to the middle element, but a linked list only supports O(n) sequential access, so locating the midpoint repeatedly costs O(n) and erases the logarithmic advantage

B

Correct Answer

Binary search needs O(1) random access to jump to the middle element, but a linked list only supports O(n) sequential access, so locating the midpoint repeatedly costs O(n) and erases the logarithmic advantage

Explanation

Binary search relies on jumping directly to the middle index in O(1), which arrays support via index arithmetic. A singly linked list requires walking node by node to reach the middle, making each "jump" O(n) and reducing the overall approach to no better than linear search.

Progress
80/100