Hw8 - CS 473 Algorithms Fall 2010 HW 8(due Tuesday November 2 This homework contains four problems Read the instructions for submitting homework on

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 1-3 can be worked in groups of up to 3 students each. Problem 0 should be answered in Compass as part of the assessment HW8-Online and should be done individually. 0. (10 pts) HW8-Online 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.

Page1 / 2

Hw8 - CS 473 Algorithms Fall 2010 HW 8(due Tuesday November 2 This homework contains four problems Read the instructions for submitting homework on

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