But what does it look like when numbers but are

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { swap X[j] and X[j+1] LastSwapIndex = j; } } LastUnsorted = LastSwapIndex; LastSwapIndex } Applied Programming OK. But what does it look like when numbers But are shuffled using these methods? are Bubble Sort will now, most likely, need less Bubble comparisons than Selection Sort. comparisons Applied Programming 9 S 6 4 3 8 7 2 5 1 Selection Sort Applied Programming 9 6 S 4 3 8 7 2 5 1 Selection Sort Applied Programming Applied Programming 9 6 S 4 3 8 7 2 5 1 9 6 Selection Sort 4 S 3 8 7 2 5 Selection Sort Applied Programming Applied 9 6 4 S 3 8 7 2 5 1 Applied Programming 9 6 Selection Sort 4 3 S 8 7 2 5 6 4 3 S 8 7 1 Selection Sort Applied Programming 9 1 2 5 1 Selection Sort Applied Programming 9 6 4 3 S 8 7 2 5 1 Selection Sort Applied Programming Applied Programming 9 6 4 3 S 8 7 2 5 1 9 6 Selection Sort 4 3 8 7 2 S 5 Selection Sort Applied Programming Applied 9 6 4 3 8 7 2 S 5 1 Applied Programming 9 6 Selection Sort 4 3 8 7 2 S 5 6 4 3 8 7 1 Selection Sort Applied Programming 9 1 2 5 1 S Selection Sort Applied Programming 1 6 S 4 3 8 7 2 5 9 Selection Sort Applied Programming Applied Programming 1 6 4 S 3 8 7 2 5 9 1 6 Selection Sort 4 S 3 8 7 2 5 Selection Sort Applied Programming Applied 1 6 4 3 S 8 7 2 5 9 Applied Programming 1 6 Selection Sort 4 3 S 8 7 2 5 6 4 3 S 8 7 9 Selection Sort Applied Programming 1 9 2 5 9 Selection Sort Applied Programming 1 6 4 3 S 8 7 2 5 9 Selection Sort Applied Programming Applied Programming 1 6 4 3 8 7 2 S 5 9 1 6 Selection Sort 4 3 8 7 2 S 5 Selection Sort Applied Programming Applied 1 6 4 3 8 7 2 S 5 9 Applied Programming 1 2 Selection Sort 4 S 3 8 7 6 5 2 4 3 S 8 7 9 Selection Sort Applied Programming 1 9 6 5 9 Selection Sort Applied Programming 1 2 4 3 S 8 7 6 5 9 Selection Sort Applied Programming Applied Programming 1 2 34 8 7 6 5 9 1 2 Selection Sort 34 5 7 6 8 Selection Sort Applied Programming Applied 1 2 34 5 6 7 8 9 Applied Programming 9 L Selection Sort 6 4 3 8 7 2 5 94 3 8 7 1 Bubble Sort Applied Programming 6 L 9 2 5 1 Bubble Sort Applied Programming 6 L 94 3 8 7 2 5 1 Bubble Sort Applied Programming Applied Programming 6 4 L 9 3 8 7 2 5 1 6 4 L Bubble Sort 9 3 8 7 2 5 Bubble Sort Applied Programming Applied 6 4 3 L 9 8 7 2 5 1 Applied Programming 6 4 Bubble Sort 3 L 9 8 7 2 5 4 3 8 L 9 7 1 Bubble Sort Applied Programming 6 1 2 5 1 Bubble Sort Applied Programming 6 4 3 8 L 9 7 2 5 1 Bubble Sort Applied Programming Applied Programming 6 4 3 87 L 9 2 5 1 6 4 Bubble Sort 3 87 L 9...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online