# lec6 - Sundar B S undar B CSIS BITS Pilani BITS Pilani...

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

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

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

View Full Document
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
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

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

View Full Document
2/7/11 Sundar B.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

lec6 - Sundar B S undar B CSIS BITS Pilani BITS Pilani...

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

View Full Document
Ask a homework question - tutors are online