# misc - A General Lower Bound for Sorting 1 Some Facts Given...

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

1 1 A General Lower Bound for Sorting 2 Some Facts … z Given a set of n distinct items, how many permutations are there ? n ! z Given a balanced binary tree with N leaves, the height of the tree is O(log N ).

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

View Full Document
2 3 Lower Bound for Sorting z Merge sort and heap sort { worst-case running time is O(N log N) z Are there better algorithms? z Goal: Prove that any sorting algorithm based on only comparisons takes (N log N) comparisons in the worst case (worse-case input) to sort N elements. 4 Lower Bound for Sorting z Suppose we want to sort N distinct elements z How many possible orderings do we have for N elements? z We can have N! possible orderings (e.g., the sorted output for a, b, c can be a b c, b a c, a c b, c a b, c b a, b c a.)
5 Lower Bound for Sorting z Any comparison-based sorting process can be represented as a binary decision tree . { Each node represents a set of possible orderings, consistent with all the comparisons that have been made. { The tree edges are results of the comparisons.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 8

misc - A General Lower Bound for Sorting 1 Some Facts Given...

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

View Full Document
Ask a homework question - tutors are online