also have a look at some of the sdd resources on this site - there might be some good stuff in there.
sorts are probably the most fiddly things you will have to do in software - and unfortunately i can guarantee you that you will either have to interpret or write a searching/sorting algorithm in every exam you do. So it is important you make the effort to understand them.....
Bubble sort compares two items at a time and swaps them if they are in the wrong order.
bubble sort in pseudocode is as follows:
Code:
procedure bubbleSort( A : list of sortable items ) defined as:
do
swapped := false
for each i in 0 to length( A ) - 2 do:
if A[ i ] > A[ i + 1 ] then
swap( A[ i ], A[ i + 1 ] )
swapped := true
end if
end for
while swapped
end procedure
Worst-case performance: when the smallest element is at the end of the list
Best-case performance: When a list is already sorted