demo-partition - 1 Partitioning in Quicksort How do we...

Info iconThis preview shows pages 1–6. 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

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: 1 Partitioning in Quicksort How do we partition in-place efficiently? Partition element = rightmost element. Scan from left for larger element. Scan from right for smaller element. Exchange. Repeat until pointers cross. Q U I C K S O R T I S C O O L partitioned partition element left right unpartitioned 2 Partitioning in Quicksort swap me partitioned partition element left right unpartitioned Q U I C K S O R T I S C O O L How do we partition in-place efficiently? Partition element = rightmost element. Scan from left for larger element. Scan from right for smaller element. Exchange. Repeat until pointers cross. 3 Partitioning in Quicksort partitioned partition element left right unpartitioned swap me Q U I C K S O R T I S C O O L How do we partition in-place efficiently? Partition element = rightmost element. Scan from left for larger element. Scan from right for smaller element. Exchange. Repeat until pointers cross. 4 Partitioning in Quicksort partitioned partition element left right unpartitioned swap me Q U I C K S O R T I S C O O L How do we partition in-place efficiently? Partition element = rightmost element. Scan from left for larger element. Scan from right for smaller element. Exchange. Repeat until pointers cross. 5 Partitioning in Quicksort partitioned partition element left right unpartitioned swap me Q U I C K S O R T I S C O O L swap me How do we partition in-place efficiently?...
View Full Document

Page1 / 19

demo-partition - 1 Partitioning in Quicksort How do we...

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

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