Created: 2023-02-26 19:24
Status: #idea
Subject: Programming
Tags: C Algorithms

Sorting Algorithm Stability

A sorting algorithm is said to be stable when the order of equal values are maintained.

The root cause of UNSTABILITY is the SWAPPING of NON-ADJACENT elements.

Why Stability is Important

It is important so that we may not shuffle Records with similar Fields, but different Primary Keys.

Importance of Sorting Algorithm Stability.png
This is an example of a stable sort, Tanmay was inserted into the Database first, therefore, he must be first.

The Impossibility Trinity of Comparison Sorts

We can only pick 2 chracteristics to include in our sorting algorithm.

Impossibility Trinity for Comparison Sorts.png

References