CSOR 4231 07F: Homework 3

Required: 5 of the following 8 problems
Points: 10 pts per problem

General Instructions

  1. Please review the homework and grading policy outlined in the course information page.

  2. On the first page of your solution write-up, you must make explicit which problems are to be graded for "regular credit", which problems are to be graded for "extra credit", and which problems you did not attempt. Please use a table something like the following

    Problem01020304 0706070809...
    CreditRCRCRCECRC RCNARCRC...

    where "RC" is "regular credit", "EC" is "extra credit", and "NA" is "not attempted" (not applicable). Failure to do so will result in an arbitrary set of problems being graded for regular credit, no problems being graded for extra credit, and a five percent penalty assessment.

  3. You must also write down with whom you worked on the assignment. If this changes from problem to problem, then you should write down this information separately with each problem.
  4. Start early, be concise but rigorous, and enjoy!

Specific Instructions

  1. Be sure to review the appendix on probability if you need extra background in that area.
  2. All logs are base 2 unless otherwise specified.
  3. Unless otherwise specified, all problems and exercises are from CLRS, Introduction to Algorithms, 2nd edition.

Problems

  1. Problem 7-2. Alternative quicksort Analysis.
  2. Problem 7-5. Median-of-3 partition.
  3. Problem 9.2. Weighted median.
  4. Exercise 9.3-1. Different sized groups.
  5. In a skip list, recall that the level of a node is the highest numbered list in which it appears. Suppose I want to create a variant of a skip list in which the probabilities of a node being on level i is as follows: Write a new version of RandomLevel to implement this variant of skip list. What is the expected time to search for an element in this data structure?
  6. Problem 12-3. Average node depth in a randomly built binary search tree.
  7. Professor Midas drives an automobile from Newark to Reno along Interstate i80. (The small i is meant to denote imaginary numbers, as this problem takes place in an alternate universe.) Professor Midas' tank holds g gallons of gas and he gets m miles per gallon. There are n gas stations along i80. You are given n values, d1,...,dn, where dj be the distance between Newark and gas station j. (You can assume that i80 is a straight line.) Now comes the bizarre part. When Professor Midas pulls into a gas station to fill his tank, if he purchases x gallons, he is charged x + (g-x)2 dollars. (He can't purchase more gas than his tank will hold and he must fill the tank completely). Give a dynamic programming algorithm which determines the set of stations at which Professor Midas should stop in order to minimize the total cost of his trip. Be sure to prove that there is optimal substructure and analyze the running time.
  8. Consider the following game. There are 21 sticks. Two players, A and B, alternate turns. In each turn, a player may pick up 1, 2, or 3 sticks. Player A goes first and the player who picks up the last stick wins. Use dynamic programming to determine an strategy for player A in which player A always wins. You must use dynamic programming for this problem.


Switch to:


cliff@ieor.columbia.edu