n! = O(nn)
5n3 − 17 n = Θ(n3)
3n2 − 9 n = O(n)
Describe a dynamic programming algorithm that produces a schedule of rides with the maximum number of rides.
In case you thought this is a totally made up problem, check out RideMax.
Now consider the following greedy algorithm. Sort the houses according to the weight of the candy they are providing. Collect candy from the houses starting from the house that provides the lightest candy, then the next lightest, ... until your bag is full.
Give a convincing argument (i.e., a proof) that this greedy strategy results in an optimum solution to the problem given above.
Explain how to transform this version of the problem into a network flow problem. You may assume that for each i, k i ≥ 2. Argue that your transformation works.