码迷,mamicode.com
首页 > 其他好文 > 详细

Sorting Algorithms

时间:2019-03-10 09:16:51      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:图片   original   equal   The   heap   bec   quicksort   ref   inf   

Reference

[1] https://www.geeksforgeeks.org/stable-quicksort/

Stability

sorting algorithm is said to be stable if it maintains the relative order of records in the case of equality of keys.

Some sorting algorithms are stable by nature like Insertion sortMerge SortBubble Sort, etc. And some sorting algorithms are not, like Heap SortQuick Sort, etc.
QuickSort is an unstable algorithm because we do swapping of elements according to pivot’s position (without considering their original positions).

If Swap is every expensive, better stability is expected.

 

技术图片

Sorting Algorithms

标签:图片   original   equal   The   heap   bec   quicksort   ref   inf   

原文地址:https://www.cnblogs.com/codingforum/p/10504080.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!