Pulsars
0 %
Log inSign up

Two Strategies, Two Complexities

Open answer

We have a sorted list of a million names, and we need to check whether a given name appears in it.

Describe the two possible strategies (linear search and binary search), give the complexity of each, and explain concretely why the second one is overwhelmingly better — by estimating the number of comparisons in the worst case.