Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ ¹ ² ³ °
 

You are not logged in.
Post a replyTopic review (newest first)
That is certainly not a wrong answer, but it only skirts the main issue.
I suppose it depends on how much easier it is to compare the items than to switch them.
Sorry, must have overlook this. Yes, those are correct. So here is the thing about models. We have two models:
are those solutions correct, Ricky?
Corret.
single swap = 1, everything else is zero?
I'm going to be attempting to illustrate something that I've waved my hands at, and really should have covered first. Then hopefully we can move on to some more interesting problems.
btw, do you think this should be moved to Coders Corner?
Your worst case is right, but what happened with your best case? You talk about swapping, but I need a number of comparisons.
hey, Ricky! I finally got a chance to work on this. here are my solutions
Actually, best to take out the outer loop and change it to a while. Changes made.
Read MeEditted also
Nope, it's only comparisons between list elements. Note my comment on line 4.
the old bubble sort, eh? 