31.2k views
1 vote
Which of the following is a stable sorting algorithm? (select all that apply.) group of answer choices

a. selection sort
b. insertion sort
c. shellsort merge sort
d. quicksort heapsort radix sort
e. counting sort

1 Answer

4 votes

Final answer:

The stable sorting algorithms are insertion sort, merge sort, radix sort, and counting sort, all of which maintain the relative order of equal keys.

Step-by-step explanation:

The stable sorting algorithms from the given options are insertion sort, merge sort, radix sort, and counting sort. A stable sorting algorithm preserves the relative order of records with equal keys (i.e., values). Here's how each of the stable sorts works:

  • Insertion sort - Inserts each item into its proper place to form the sorted list.
  • Merge sort - Divides the unsorted list into n sublists, each containing one element, then repeatedly merges sublists to produce new sorted sublists until there is only one sublist remaining.
  • Radix sort - Sorts data with integer keys by grouping keys by the individual digits that share the same significant position and value.
  • Counting sort - Uses an auxiliary array to tally the occurrences of each value, then places elements in the correct position according to the counts and their original positions for ties.
User Staterium
by
8.6k points