This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 15-121: Introduction to Data Structures Exercise 09/16/2009 Dropping Balls Fall 2009 Due: Fri, Sept 18 10:30am beginning of class Assignment: (worth 3 exercise points) For this exercise, you may work in pairs (no more than 2, though). If you do work in a pair, only submit one copy with both names on it. By putting two names on it, you are stating that both of you contributed significantly to the answer. Setup: • • • • • You are in an N-story building. You are given two identical glass balls. Imagine dropping one ball out of a window. The ball will either shatter when it hits the ground, or it will be unscathed. There is some story, K, for which the ball will be unscathed if dropped from stories 1 .. K, but will shatter if dropped from stories K+1 … N. Task: Give an algorithm to find K, using the most efficient method you can devise. • As long as the ball is not shattered, you can go pick it up and drop it from another window. • Remember that both balls are identical, so have the same value of K. • Be sure to tell why you think your method is efficient. Handin: • Write up your answer neatly (handwritten is okay, but "typed" may be better). • Bring two copies to class on Friday. One to handin. One to refer to in discussion. Place the handin copy on the desk in the front of the room. • Be sure your name(s) AND section letter(s) are on the handin. ...
View Full Document
This document was uploaded on 12/19/2009.
- Spring '09
- Data Structures