{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6.046_Lecture04_RandomizedQuicksort

# 6.046_Lecture04_RandomizedQuicksort - 6.046 Introduction to...

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

6.046 Introduction to Algorithms, Lecture 4 February 14, 2005 Randomized Algorithms, Quicksort 1 Introduction to Algorithms 6.046J/18.401J Lecture 4 Prof. Manolis Kellis Today Randomized algorithms: algorithms that flip coins – Matrix product checker: is AB=C ? – Quicksort: Example of divide and conquer Fast and practical sorting algorithm Other applications on Wednesday – Friday (6.096): Application in computational biology Discovering common motifs in DNA sequences Randomized Algorithms Algorithms that make random decisions That is: – Can generate a random number x from some range {1…R} – Make decisions based on the value of x Why would it make sense ? Two cups, one coin If you always choose a fixed cup, the adversary will put the coin in the other one, so the expected payoff = \$0 If you choose a random cup, the expected payoff = \$0.5 Randomized Algorithms Two basic types: – Typically fast (but sometimes slow): Las Vegas – Typically correct (but sometimes output garbage): Monte Carlo The probabilities are defined by the random numbers of the algorithm! (not by random choices of the problem instance) Matrix Product Compute C=A × B – Simple algorithm: O(n 3 ) time – Multiply two 2 × 2 matrices using 7 mult. O(n 2.81… ) time [Strassen’69] – Multiply two 70 × 70 matrices using 143640 multiplications O(n 2.795… ) time [Pan’78] – … – O(n 2.376… ) [Coppersmith-Winograd]

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

View Full Document