begin BubbleSort(list)
while not sorted
for all elements of list
if list[i] > list[i+1]
swap(list[i], list[i+1])
end if
end for
end while
return list
end BubbleSort
begin SelectionSort(list)
set MIN to list[0]
while not sorted
for all elements of list
Find the minimum element in the list
end for
Swap with value at location MIN
Increment MIN to point to next element
end while
return list
end SelectionSort
begin Heapsort(list)
Heapify(list,0)
for i = length(list) to 2
swap list[1] and list[i]
heapsize = heapsize -1
Heapify(list, 1)
Heapify(list, i)
le = left(list)
ri = right(list)
if (le <= heapsize) and (list[le] > list[i])
largest = le
else
largest = i
if (ri <= heapsize) and (list[ri] > list[largest])
largest = ri
if (largest != i)
swap list[i] and list[largest]
Heapify(list, largest)