Next:
Up:
Previous:
Accuracy
Why do later passes not mess up earlier sorts?
Prove that after pass p, sorted for digit p+1 to last digit
Prove by induction over p
True for p=1. Apply Stable sort to digit 1, sorted after pass
Assume true for p=i, prove true for p=i+1
After pass i, compare two numbers x and y
If x appears before y then one of following conditions must be true
1.
x
<
y
for digit
i
, then
x
belongs before
y
in sorted order
2.
x
=
y
for digit
i
, then
x
<
y
for rest of number, placed in that order in earlier pass, not swapped because use stable sort
Next:
Up:
Previous: