05-02-2006, 10:59 AM
Quote:......When the issue of stability was raised, it wasn't apparent that we are only sorting keys for this contest. Usually, data records are composed of keys and some data portion. When you have a data portion, stability can be an issue. If two input records had the same key but diffferent data, and your sort changed the original order of these records, then the sort is not stable.
P.S. Also I did not understand someone else's question that seem to reduce to
163532
If I sort this to
123356
does it matter which 3 comes first?
Hunhh? Whoever it was: what are you talking about? 3=3. No such concept in my mind of which comes first.
Mac
Why would you need stability? Assume we had a file where the data portiion was already sorted by name. Now we want to sort the file by zipcode. Using a stable sort, we just need to sort on the zipcode key, and the names will still be in sequence within each zipcode. For an unstable sort, we would have to sort on 2 keys, the zipcode as major and the name as minor --- more time.
BTW, when Antoni says "REGISTER" he is translating from Spanish, and he really means "RECORD".
*****