ABSTRACT

Stability and Unstability are the main characteristics of every sorting algorithm. A sorting algorithm can either be stable or unstable based on some conditions. Mainly stable sort includes Bubble sort, Insertion sort, Merge sort and unstable sort includes Heap sort, Selection sort, and Quick sort. There is various Literature that compared these sorting algorithms based on platform-dependent factors like Space complexity but very few researchers had compared based on platform-independent factors. This study Compares these stable and unstable algorithms based on factors like in-place, data sensitivity, time complexity: best, average, a worst-case as well as platform-dependent factors. The code was implemented in MATLAB and Timeit() function is used to calculate elapsed time. If anyone wants to maintain the first come first serve order in sorting of data then stable sort is used. The outcome of research shows that in terms of elapsed time insertion sort is the fastest stable sort when input data is small but it increases merge sort will be the fastest 464algorithm. In case of unstable algorithm, selection sort will be fastest if input data is small and heap sort is fastest as the size of input data increases.