1 votes 1 votes When sorting technique is called stable? Algorithms algorithms sorting + – imnitish asked Jul 9, 2018 • retagged Jun 29, 2022 by makhdoom ghaya imnitish 892 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply MiNiPanda commented Jul 9, 2018 reply Follow Share When relative ordering of equal keys is preserved after sorting then it is called stable. Eg: Let the array of elements be : 51,21,52,4,22,1 The subscript is used to mark the relative positions of two equal elements. After sorting if the array becomes: 1,21,22,51,52 then the sorting technique is stable. Bubble sort, Insertion sort, selection sort, merge sort are stable while quick sort and heap sort are not. In case of unstable sorting algo the sorted array may become: 1,22,21,52,51 0 votes 0 votes Shraddha0609 commented Jul 20, 2018 reply Follow Share Selection sort is not a stable sorting algorithm 0 votes 0 votes MiNiPanda commented Jul 20, 2018 reply Follow Share 1.https://www.geeksforgeeks.org/stable-selection-sort/ Selection sort can be made Stable if instead of swapping, the minimum element is placed in its position without swapping i.e. by placing the number in its position by pushing every element one step forward. 2. https://stackoverflow.com/questions/20761396/why-selection-sort-can-be-stable-or-unstable It shouldn't be too hard to modify an unstable selection sort algorithm to become stable. 0 votes 0 votes jys commented Nov 2, 2019 reply Follow Share How selection sort is stable?? 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes Stable sorting algorithms maintain the relative order of records with equal value. That is, a sorting algorithm is stable if whenever there are two records R and S with the same key and with R appearing before S in the original list, R will appear before S in the sorted list. Example: merge sort, insertion sort ,bubble sort In below example 4 have repeated . Now when we sort them then 4a must be come first. Becz in orignal list 4a comes first . 2 , 4a , 6, 4b ,8 Sort above list 2 ,4a, 4b ,6, 8 abhishekmehta4u answered Jul 9, 2018 abhishekmehta4u comment Share Follow See 1 comment See all 1 1 comment reply Shobhit Joshi commented Jan 11, 2019 reply Follow Share bubble and insertion are stable 0 votes 0 votes Please log in or register to add a comment.