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

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

View Full Document Right Arrow Icon
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 ).
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 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.)
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online