3 ms·
I think the assumption is that you sort once and search several times (enough to amortize the cost of the sort). The linear search algorithm also had an early e
by exDM69 12y ago
I think the assumption is that you sort once and search several times (enough to amortize the cost of the sort). The linear search algorithm also had an early exit, so the array has to be sorted for that too. That makes this a fair comparison, but I agree that seeing a linear unsorted search would have been interesting too.