SelectionSort(A, size)
- for current = 0 to size-2
- small = current
- for candidate = current+1 to size-1
- if A[small] > A[candidate]
- small = candidate
- if small ≠ current
- swap(A[small], A[current])
BubbleSort(A, size)
- set last to be size-1
- set swapped to be true
- while swapped is true
- set swapped to be false
- for i = 1 to last
- if A[i] < A[i-1]
- set swapped to be true
- swap A[i] and A[i-1]
- set newLast to be i-1
- last = newLast
InsertionSort(A, size)
- for position = 1 to size-1
- tmp = A[position]
- candidate = position
- while candidate > 0 and A[candate-1] > tmp
- A[candidate] = A[candidate-1]
- candidate = candidate - 1
- A[candidate] = tmp