Bubble Sort!
Tyralyn Tran
http://www.internationalhero.co.uk/p/powpuff1.jpg http://www.skorks.com/wp- content/uploads/2010/05/sort.jpg
Bubble Sort! Tyralyn Tran What is a bubble sort?!?!?!?!?!?!?!? In - - PowerPoint PPT Presentation
http://www.internationalhero.co.uk/p/powpuff1.jpg http://www.skorks.com/wp- content/uploads/2010/05/sort.jpg Bubble Sort! Tyralyn Tran What is a bubble sort?!?!?!?!?!?!?!? In a bubble sorting algorithm, the elements of the list
Tyralyn Tran
http://www.internationalhero.co.uk/p/powpuff1.jpg http://www.skorks.com/wp- content/uploads/2010/05/sort.jpg
In a bubble sorting algorithm, the elements of the list "gradually 'bubble' (or rise) to their proper location in the array, like bubbles rising in a glass of soda" (1).
http://www.mostphotos.com/preview/984135/funny-nun-blowing-bubbles.jpg
http://3.bp.blogspot.com/-_XaP-whvEAk/TsQESafnndI/AAAAAAAAAGM/lT7WcPCnkJI/s640/running-away.jpg
○ The list stays the same because 5 is less than 12.
○ 3 and 12 are switched because 3 is less than 12
○ 9 and 12 are switched since 9 is less than 12
○ 12 and 16 do not switch because 12 is less than 16
○ 3 is less than 5, so they switch
○ 5 is less than 9 so they remain in the same places
○ 12 is greater than 9 so they do not switch places
○ 12 and 16 are in numerical order so they don't switch
○ 3 is less than 5, so they do not switch
○ 5 is less than 9 so they remain in the same places
○ 12 is greater than 9 so they do not switch places
○ 12 and 16 are in numerical order so they don't switch
http://chzmemebase.files.wordpress.com/2012/03/internet-memes-yo-dawg-i-heard-you-like-bubbles1.jpg
Pass 1 m z g i p a m g z i p a m g i z p a m g i p z a m g i p a z Pass 2 g m i p a z g i m p a z g i m p a z g i m a p z g i m a p z
a g i m p z a g i m p z a g i m p z a g i m p z a g i m p z Pass 5 a g i m p z a g i m p z a g i m p z a g i m p z a g i m p z
http://msalvarez1.edublogs.org/files/2009/10/funny-pictures-cat-is-in-bubble.jpg
○ (n)(1) = n
○ (n)(n-1) = n^2. . .
○ (n)(n/2)=(n^2)/2
http://ihasahotdog.files.wordpress.com/2011/08/funny-dog-pictures-tiny-bubbles-in-the-wind-make-me-feel-happy.jpg
http://www.funnypicture.in/funnypicture/4089_bubbles!.jpg
http://roknor.com/blog/wp- content/uploads/2011/01/funny-pictures- cat-bites-bubble-wrap.jpg
that which the array or list itself occupies.
code.
is good for testing whether or not a list is sorted or
whole sorting sequence, which often have running- times of O(n^2) or O(n log n) for this task.
items that need to be swapped a few times.
http://cdn.10dailythings. com/images/imagestoo_20many_2 0bubbles.jpg
http://www.officehell.co.uk/uploads/items/images/Surprised-Coffee-749.jpg
/Bubble_sort