Introduction to Algorithms, Second Edition

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

View Full Document Right Arrow Icon
The University of Texas at Austin Department of Computer Sciences Professor Vijaya Ramachandran Lecture 21 CS357: ALGORITHMS, Spring 2006 Lower bound on comparison-based sorting There are several algorithms that sort n elements in O ( n log n ) time using only comparisons between pairs of input elements in order to obtain their relative ordering. These include MergeSort and Heapsort and also Quicksort (expected time when randomized). An algorithm that sorts n elements by only making comparisons between pairs of input elements in order to deduce their relative order will be called a comparison-based algorithm . We will now show that any comparison-based algorithm for sorting must make Ω( n log n ) comparisons and hence must have Ω( n log n ) running time. Let A be such an algorithm. As described in the textbook, we will capture the comparisons it makes on every input of length n in terms of a binary decision tree . Thus the decision tree represents all comparisons made by the algorithm on every input of length n , but ignores data movement and other aspects of the algorithm. The leaves of this decision tree represent all possible outputs for an input of length n : for diFerent inputs we take diFerent paths down the tree and reach diFerent leaves. Notice that there are
Background image of page 1

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

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

This note was uploaded on 01/30/2008 for the course CS 357 taught by Professor Ramachandran during the Spring '06 term at University of Texas at Austin.

Page1 / 4

Lecture 21 - The University of Texas at Austin Department...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online