Selection Sort

Selection sort is a straightforward sorting algorithm. This sorting method is an in-place comparison-based algorithm that divides the list into two halves, the sorted part on the left end and the unsorted part on the right. Initially, the sorted section is empty, while the unsorted section contains the complete list. The smallest element from the …

Selection Sort Read More »

Insertion Sort

This is a sorting algorithm that uses in-place comparisons. A sub-list is kept here that is always sorted. For instance, the lower part of an array is kept in order to be sorted. An element that is to be ‘inserted’ into this sorted sub-list must first identify its right spot and then be inserted there. …

Insertion Sort Read More »

Bubble Sort

Bubble sort is a straightforward sorting method. This sorting algorithm is a comparison-based method that compares each pair of adjacent elements and swaps them if they are not in order. Because its average and worst-case complexity are Ο(n2), where n is the number of items, this approach is not suitable for huge data sets. Algorithm …

Bubble Sort Read More »