If you have Knuth's book Searching and Sorting, these are well explained.
Otherwise, you can find good discussions online.
What is the running time for:
-Linear Search
-Binary search
-bubble sort
For each algorithm above, why do they take the time that they do?
1 answer