# sorting - 7 11 13 30] Bubble Sort (BigO: N 2 ) % the lines...

This preview shows pages 1–2. Sign up to view the full content.

Original Vector: [6 30 11 2 7 5 3 13] Insertion Sort (BigO: N 2 [ ] [6] [6 30] [6 11 30] [2 6 11 30] [2 6 7 11 30] [2 5 6 7 11 30] [2 3 5 6 7 11 30] [2 3 5 6 7 11 13 30] Quick Sort (BigO: N*log(N)) [2 5 3] [6] [30 11 7 13] % where [6] is the pivot. Any numbers less 6 than go to the left, bigger than 6 go to the right. [] [2] [5 3] [6] [11 7 13] [30] [] % [2] is the new pivot on the left and [30] is the new pivot on the right. [2] [3] [5] [] [6] [7] [11] [13] [30] % [5] and [11] are the new pivots on the left and right respectively. [2 3 5 6 7 11 13 30] Merge Sort (BigO: N*log(N)) [6 30 11 2 7 5 3 13] [6 30 11 2] [7 5 3 13] [6 30] [11 2] [7 5] [3 13] [6] [30] [11] [2] [7] [5] [3] [13] [6 30] [2 11] [5 7] [3 13] [2 6 11 30] [3 5 7 13] [2 3 5 6

This preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: 7 11 13 30] Bubble Sort (BigO: N 2 ) % the lines with a * at the end are the lines you need to show during the test. Please DO NOT show the intermediate steps. Original: [6 30 11 2 7 5 3 13] [6 11 30 2 7 5 3 13] [6 11 2 30 7 5 3 13] [6 11 2 7 30 5 3 13] [6 11 2 7 5 30 3 13] [6 11 2 7 5 3 30 13] [6 11 2 7 5 3 13 30] * [6 2 11 7 5 3 13 30] [6 2 7 11 5 3 13 30] [6 2 7 5 11 3 13 30] [6 2 7 5 3 11 13 30] * [2 6 7 5 3 11 13 30] [2 6 5 7 3 11 13 30] [2 6 5 3 7 11 13 30] * [2 5 6 3 7 11 13 30] [2 5 3 6 7 11 13 30] * [2 3 5 6 7 11 13 30] * Therefore, you only need to show the following lines: [6 11 2 7 5 3 13 30] [6 2 7 5 3 11 13 30] [2 6 5 3 7 11 13 30] [2 5 3 6 7 11 13 30] [2 3 5 6 7 11 13 30]...
View Full Document

## This note was uploaded on 01/26/2011 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

### Page1 / 2

sorting - 7 11 13 30] Bubble Sort (BigO: N 2 ) % the lines...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online