Sorting2.2 - In-Place Quick-Sort 14 31 30 23 25 88 52 79...

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: In-Place Quick-Sort 14 31 30 23 25 88 52 79 Get one friend to sort the second half. Get one friend to sort the first half. 62,79,98,88 14,23,25,30,31 CSE 2011 Prof. J. Elder 62 98 - 61 - Last Updated: 4/1/10 11:16 AM In-Place Quick-Sort 14,23,25,30,31 52 62,79,98,88 Glue pieces together. (No real work) 14,23,25,30,31,52,62,79,88,98 CSE 2011 Prof. J. Elder - 62 - Last Updated: 4/1/10 11:16 AM The In-Place Partitioning Problem Input: Output: x=52 14 31 30 23 25 88 52 14 31 25 98 30 23 62 79 88 52 < 62 98 79 Problem: Partition a list into a set of small values and a set of large values. CSE 2011 Prof. J. Elder - 63 - Last Updated: 4/1/10 11:16 AM Precise Specification p r q p CSE 2011 Prof. J. Elder - 64 - r Last Updated: 4/1/10 11:16 AM Loop Invariant 3 subsets are maintained One containing values less than or equal to the pivot One containing values greater than the pivot One containing values yet to be processed CSE 2011 Prof. J. Elder - 65 - Last Updated: 4/1/10 11:16 AM ...
View Full Document

Page1 / 5

Sorting2.2 - In-Place Quick-Sort 14 31 30 23 25 88 52 79...

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