# Sorting Algorithms for data

A sorting algorithm is stable if two data items having the same value are not rearranged with respect to each other at any stage of the algorithm. For instance, in the five-element vector

55 12 33

a stable sorting algorithm guarantees that the final ordering is

12 33 55

classify each of the algorithms as to there stability. 1.Heap 2.Insertion 3.Merge 4.Quicksort 5.Radix 6.Selection

© BrainMass Inc. brainmass.com October 9, 2019, 11:54 pm ad1c9bdddfhttps://brainmass.com/computer-science/sorting/sorting-algorithms-data-271905

#### Solution Preview

We consider the sequence 2, 1, 2, 3

To identity the first 2 and the second 2, we use 2(1) and 2(2). So the sequence is 2(1), 1, 2(2), 3

Stable sorting algorithms are

2. Insertion sort

The insert sort work flow is as follows.

a. 2(1)

b. 1, 2(1)

c. 1, 2(1), 2(2)

d. 1, 2(1), 2(2)

So it is stable.

3. Merge ...

#### Solution Summary

The expert examines sorting algorithms for data.