This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: With each pass compare adjacent pairs and swap if out of order. Can examine one less element with each pass bubble up the next largest element in sorted order. Bubble Sort 11 8 3 17 22 12 9 5 Mergesort Start with small lists of size 1 each Merge 2 lists of size 1 into list of size 2 Merge 2 lists of size 2 into list of size 4 Merge 2 lists of size 4 into lists of size 8 Etc. Mergesort 11 8 3 17 22 12 9 5 Compare the sorts Compare with sizes of data, what happens with each sort as the size of the input doubles? Compare with different types of data Random data Reverse order Almost sorted...
View Full
Document
 Fall '09

Click to edit the document details