# Bubble sort algorithm?

Can any show me how to perform a bubble sort algorithm for the following two lists.

here are the instruction for the algorithm

1. get values for n and the n list of items
2. set the marker u for the unsorted section at the end of the list
3. while the unsorted section has more than one element do steps 4 through 8
4. set the current marker c at the second element of the list
5. while c has not passed u do step 6-7
6. if the item at position is less than the item to the left the exchange these two items
7. move c to the right one position
8. move u to the left one positon 9.stop

list 1 $(4,8,2,6)$

list 2 $(12,3,6,8,2,5,7)$

Where I am confused on the first one is that it tells me in the algorithm the c marker is the second element of the list and U is in the unsorted section of the list and it must not continue c until it passes u It kind of confuses me.

-
Forget those instructions. They're terribly written. Understand what the algorithm is doing from here: en.wikipedia.org/wiki/File:Bubble-sort-example-300px.gif // The idea is that in each iteration $i$, the $i^{th}$ greatest/smallest element makes its way to its rightful position in the list via a series of swaps. – RDN Feb 24 at 4:05
I agree. I think the picture is not a big help, though. Check out the Wikipedia article which contains examples and properly written pseudocode. – Raphael Feb 24 at 16:17