This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 473: Algorithms, Fall 2010 HW 8 (due Tuesday, November 2) This homework contains four problems. Read the instructions for submitting homework on the course webpage . In particular, make sure that you write the solutions for the problems on separate sheets of paper; the sheets for each problem should be stapled together. Write your name and netid on each sheet. Collaboration Policy: For this home work, Problems 13 can be worked in groups of up to 3 students each. Problem 0 should be answered in Compass as part of the assessment HW8Online and should be done individually. 0. (10 pts) HW8Online on Compass. 1. (35 pts) Suppose we want to write an efficient function Shuffle( n ) that returns a permutation of the set { 1 , 2 ,...,n } chosen uniformly at random. (a) Prove that the following algorithm is not correct.[Hint: Consider n = 3.] Algorithm Shuffle ( n ) 1. for i ← 1 to n 2. do π [ i ] ← i 3. for i ← 1 to n 4. do swap π [ i ] ↔ π [Random( n )] 5. return π [1 ...n ] (b) Prove that the following implementation of Shuffle(...
View
Full
Document
This note was uploaded on 01/22/2011 for the course CS 473 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Chekuri,C
 Algorithms

Click to edit the document details