lec6 - 2/7/11 2/7/11 Sundar B. S undar B. CSIS, BITS,...

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style 2/7/11 Sundar B. CSIS, Sorting - QuickSort QuickSort - Time Complexity - Best and worst cases - Analyses - Pivot Selection – Median of 3, Random, Median of Medians - Special Cases: Small Lists, Equal- 11
Background image of page 1

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

View Full DocumentRight Arrow Icon
2/7/11 Sundar B. QuickSort – Time Complexity Time Complexity of Partition: Ѳ(N) - Why? Quick Sort – Time - Worst case (recurrence relation): T(N) = T(N-1) + Ѳ(N) for N>1 = Ѳ(1) for N=1 T(N) = ? When does the worst case occur? Quick Sort – Time - Best case (recurrence relation): 22
Background image of page 2
2/7/11 Sundar B. QuickSort – Time Complexity Average Case: By assuming input distributions to be random one can compute the average case complexity. Verify that O(N*logN) is a solution to recurrence relation: T(N) = Ѳ(N) + (1/N) * (∑k=1toN (T(k-1) + T(N- k))) for N>1 T(N) = 1 for N <= 1 But the time taken for a specific input depends heavily on the pivot(s) chosen for partitioning. 33
Background image of page 3

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

View Full DocumentRight Arrow Icon
2/7/11 Sundar B.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

lec6 - 2/7/11 2/7/11 Sundar B. S undar B. CSIS, BITS,...

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