If I have an array that is not sorted and contains duplicate values, which of these sorting techniques will successfully accomplish my sort: heap sort, selection sort, or bubble sort? [ April 05, 2007: Message edited by: Senaca Boyd ]
i don't remember which of these are which, but there is the concept of a 'stable' vs. 'unstable' sort.
this concept relates to how you handle two items with the same key. in a stable sort, the pre-sort order of items with the same key is preserved. an unstable sort makes no garantees either way.
this is more of an issue when you are sorting on multiple fields - say first and last name. if i sort by first name first, when i then sort by last name, i want to keep all the smiths in the order they came to me.
I don't know if that is what you were thining of or not. but if you are sorting on a single element, the sort algorithm shouldn't matter.
some may be more or less efficient, but again, i don't think that is what you were aiming towards