Step 3: Analyze Running Time

The correctness proof also gave us a nice way to bound the worst-case run-time: tex2html_wrap_inline239 .

It is also instructive to look at the best case. We have to execute the ``for loop'' at least once, so tex2html_wrap_inline247 .

And for a sorted list, this bound is acheived. So tex2html_wrap_inline249 is the best-case running time.


next up previous
Next: An Assortment of Sorts Up: BUBBLESORT Previous: Improvements in Bubblesort