Selection Sort

  • a brute-force sorting algorithm
  1. set i = 0
  2. Repeatedly find the smallest element, and swap it with the ith element
  3. update i += 1
SelectionSort(A[0..n-1])
    for i=0 to n-2

Bubble Sort


In [ ]:
BubbleSort(A[0..n-1])

Range-limiting Bubble Sort


In [ ]:

Alternating Bubble Sort


In [ ]:

Insertion Sort

  • Partial sorting

In [ ]:

Merge Sort

  • A recursive divide-and-conqure algorithm
  • Divide the list into two sub-lists recursively
  • Merge the two sorted sub-lists

Merge sort requires an additional array for intermediate storage. Therefore, if memory is an issue in your application, go with the quicksort.


In [ ]:

Quicksort

in place

Bucket sort


In [ ]:

Radix sort


In [ ]: