Assume the list is not sorted (sorted is set to FALSE)
while(!sorted)
{
Assume the list is sorted (sorted is set to TRUE)
Set i to loop through list from first to last - 1
{
if list[i] and list[i + 1] are not in the right order
{
switch them (called a swap)
set sorted to FALSE
}
}
}