Posted by: oldmaven September 20, 2010
Login in to Rate this Post:
0
?
Insertion Sort is stable.
Heap Sort is unstable. You cannot maintain the order of keys once sorted. If you really want to "pretend" you made heap sort stable, do one thing BUT strongly not recommended unless you want to be a smart-ass.
- Heap sort is a special case of selection sort, with building Heap every time it does the basic selection sorting. Now - skip building Heap :)
- So you are left with selection sort Only, which is not stable either. But there is a way you can make selection sort stable.
Follow this link to the way you could make a selection sort stable by "wildfrog"
http://www.codeguru.com/forum/showthread.php?t=362340
Heap Sort is unstable. You cannot maintain the order of keys once sorted. If you really want to "pretend" you made heap sort stable, do one thing BUT strongly not recommended unless you want to be a smart-ass.
- Heap sort is a special case of selection sort, with building Heap every time it does the basic selection sorting. Now - skip building Heap :)
- So you are left with selection sort Only, which is not stable either. But there is a way you can make selection sort stable.
Follow this link to the way you could make a selection sort stable by "wildfrog"
http://www.codeguru.com/forum/showthread.php?t=362340