Sorting2.7 - Properties of QuickSort In-place? Stable?...

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: Properties of QuickSort In-place? Stable? Fast? Depends. Worst Case: Expected Case: CSE 2011 Prof. J. Elder - 86 - Last Updated: 4/1/10 11:16 AM Summary of Comparison Sorts Algorithm Best Case Worst Case Average Case In Place Stable Comments Selection n2 n2 Yes Yes Bubble n n2 Yes Yes Insertion n n2 Yes Yes Good if often almost sorted Merge n log n n log n No Yes Good for very large datasets that require swapping to disk Heap n log n n log n Yes No Best if guaranteed n log n required Quick n log n n2 Yes No Usually fastest in practice CSE 2011 Prof. J. Elder n log n - 87 - Last Updated: 4/1/10 11:16 AM Comparison Sort: Lower Bound MergeSort and HeapSort are both (n log n) (worst case). Can we do better? CSE 2011 Prof. J. Elder - 88 - Last Updated: 4/1/10 11:16 AM Comparison Sort: Decision Trees Example: Sorting a 3-element array A[1..3] CSE 2011 Prof. J. Elder - 89 - Last Updated: 4/1/10 11:16 AM Comparison Sort: Decision Trees For a 3-element array, there are 6 external nodes. For an n-element array, there are n ! external nodes. CSE 2011 Prof. J. Elder - 90 - Last Updated: 4/1/10 11:16 AM ...
View Full Document

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

Sorting2.7 - Properties of QuickSort In-place? Stable?...

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