Algorithms and Data Structures · Senior · Question 42 of 75

Why can't you run binary search efficiently on a linked list?

Explanation

Binary search relies on O(1) access by index. On a list each halving step walks half the remaining nodes, so the total is O(n). Skip lists add extra pointers to restore O(log n).

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 42

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz