1. Engineering
  2. Computer Science
  3. need help with homework...

Question: need help with homework...

Question details

Need help with homework.

Part 1: Written (50 points) Please type or neatly handwrite your responses and turn in a physical copy in class the day this problem set is due. Responses will be graded on correctness and clarity. When you are asked to justify or prove a problem, please do so in complete sentences. (1) (10 points) Compute the following expressions to at least two decimal places. You may not use a calculator, and you must show your work. You may use the fact that log(3)-1.585. Recall that, in this class, log(r) log,2) (a) (2 points) log(128) (b) (2 points) log(1/32) (c) (3 points) log(6) (d) (3 points) logs (3) Questions 2-5 refer to the generalized number guessing game from Lectures 1-2. Recall the rules of the game: I am thinking of a number between 0 and n-1, inclusive. Guess what it is! After each guess, I will tell you if you are correct, too low, or too high (2) (10 points) For the following values of n, state the worst-case number of guesses G(n) that it will take to guess my number. Justify your answers. (a) (3 points) n 128 (b) (3 points) n 100 (c) (2 points) n 31 (d) (2 points) n 33 (3) (10 points) Suppose I am guessing your number by guessing the middle of the possible range each time, rounded up. For example, if 32, my first guess will be (n 1)/2115.5 16. What number can you pick to make me take the maximum possible number of guesses? Prove your answer

(4) (10 points) Imagine you are writing a computer program to play the game 20 Questions. In this game, the user thinks of a person, place, or thing and the computer program can ask up to twenty yes/no questions before guessing what the user is thinking of. (a) (7 points) Describe how you might design a computer program to play this game. Hint: This question is one of the ones referring to the number guessing game. (b) (3 points) Suppose that the user had to pick their person, place, or thing from a defined list rather than thinking of one randomly. State and justify an upper bound for the size of this defined list such that the computer program is guaranteed to guess the users answer correctly. (5) (10 points) In this problem, we will formally prove that, for any n, the maximum number of guesses G (n) eeded to solve the guessing game with bounds 0 and n 1 is G(n)log(n) +1 (a) (3 points) Describe why G(n) -log(n) +1 for n 1 (b) (2 points) Prove that if G(n/2) -log(n/2) 1 and n/2 is a power of 2, then G(n)-log(n) +1 (c) (2 points) Suppose that n is a power of 2 and is greater than 1, and that the formula G(k)og(k)+1 holds for kS n. Prove that the formula G(k) holds for k-n1 (d) (2 points) Suppose that n is a power of 2 and is greater than 1, and that the formula G(k)log(k) +1 holds for k. Prove that the formula G(k) holds for k 2n-1 (e) (1 point) Using the results of parts (a) through (d), prove that the formula G(n) - [log(n) +1] holds for all integers n greater than zero.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution