M
Michael Campbell
I don't know if bubble sort using a random number for comparisons
is
No, that's an optimization to end early if there *ARE* no swaps. The
sort still just runs through the list a maximum n (or n-1) times. (Or
at least there's no reason NOT to.)
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
is
always a good idea. Bubble sort runs over the array and compares two
subsequent values and swaps them if they are out of order.
It keeps doing that until there are no more swaps during a run.
No, that's an optimization to end early if there *ARE* no swaps. The
sort still just runs through the list a maximum n (or n-1) times. (Or
at least there's no reason NOT to.)
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com