Sorting2.1 - Execution Example (cont.) Recursive call,...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Execution Example (cont.) Recursive call, pivot selection CSE 2011 Prof. J. Elder - 56 - Last Updated: 4/1/10 11:16 AM Execution Example (cont.) Partition, …, recursive call, base case CSE 2011 Prof. J. Elder - 57 - Last Updated: 4/1/10 11:16 AM Execution Example (cont.) Join, join CSE 2011 Prof. J. Elder - 58 - Last Updated: 4/1/10 11:16 AM Quick-Sort Properties The algorithm just described is stable, since elements are removed from the beginning of the input sequence and placed on the end of the output sequences (L,E, G). However it does not sort in place: O(n) new memory is allocated for L, E and G Is there an in-place quick-sort? CSE 2011 Prof. J. Elder - 59 - Last Updated: 4/1/10 11:16 AM In-Place Quick-Sort Note: Use the lecture slides here instead of the textbook implementation (Section 11.2.2) Partition set into two using randomly chosen pivot 88 52 14 31 25 98 30 23 62 79 14 31 30 23 25 CSE 2011 Prof. J. Elder 88 52 - 60 - 62 98 79 Last Updated: 4/1/10 11:16 AM ...
View Full Document

Page1 / 5

Sorting2.1 - Execution Example (cont.) Recursive call,...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online