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 Final Exam Questions Extended Dance Remix Spring 2010 This exam lasts 180 minutes. Write your answers in the separate answer booklet. Please return this question sheet with your answers. 1. Choreographer Michael Flatley has hired a new dance company to perform his latest Irish step dancing extravaganza. At their first practice session, the new dancers line up in a row on stage and practice a movement called the Flatley Flip : Whenever Mr. Flatley calls out any positive integer k , the k rightmost dancers rotate 180 degrees as a group, so that their order in the line is reversed. Each dancer wears a shirt with a positive integer printed on the front and back; different dancers have different numbers. Mr. Flatley wants to rearrange the dancers, using only a sequence of Flatley Flips, so that these numbers are sorted from left to right in increasing order. 7 4 1 5 3 8 2 6 6 2 8 3 5 7 4 1 6 2 7 4 1 5 3 8 5 3 Two Flatley flips. (a) Describe an algorithm to sort an arbitrary row of n numbered dancers, using O ( n ) Flatley flips. (After sorting, the dancers may face forward, backward, or some of each.) Exactly how many flips does your algorithm perform in the worst case? 1 (b) Describe an algorithm that sorts an arbitrary row of n numbered dancers and ensures that all dancers are facing forward , using O ( n ) Flatley flips. Exactly how many flips does your algorithm perform in the worst case? 2 2. Youre in charge of choreographing a musical for your local community theater, and its time to figure out the final pose of the big showstopping number at the end. (Streetcar!) Youve decided that each of the n cast members in the show will be positioned in a big line when the song finishes, all with their arms extended and showing off their best spirit fingers. The director has declared that during the final flourish, each cast member must either point both their arms up or point both their arms down; its your job to figure out who points up and who points down. Moreover, in a fit of unchecked power, the director has also given you a list of arrangements that will upset his delicate artistic temperament. Each forbidden arrangement is a subset of cast members paired with arm positions; for example: Marge may not point her arms up while Ned and Apu point their arms down. Prove that finding an acceptable arrangement of arm positions is NPhard. [Hint: Describe a reduction from 3SAT.] 1 This is really a question about networking. 2 This is really a question about mutating DNA....
View
Full
Document
This note was uploaded on 01/22/2012 for the course CS 573 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Chekuri,C

Click to edit the document details