Homework 6 COMS 311 Points: 100 Due: Oct 24, 11:59PM
Late submission policy. If you submit by Oct 25, 11:59PM, there will be 20% penalty. That is, if your score is x points, then your final score for this homework after the penalty will be 0.8 × x. Submission after Sept 19, 11:59PM will not be graded without explicit permission from the instructors.
Submission format. Your submission should be in pdf format. Name your submission file:
If you are planning to write your solution and scan+upload, please make sure the submission is readable (sometimes scanned versions are very difficult to read – poor scan quality to blame).
If you plan to snap pictures of your work and upload, please make sure the generated pdf is readable – in most cases, such submissions are difficult to read and more importantly, you may end up submitting parts of your work.
If you would like to type your work, then one of the options you can explore is latex.
Rules for Algorithm-design Problems.
1. For all algorithm design problems, part of the grade depends on the run-time. Better the run-time, higher the grade.
2. You may use any standard algorithms that we have covered as part of the lecture sessions (e.g., Binary Search, heap operations, Breadth-first exploration with Layers, Dijkstra, Prim)
3. Write Pseudo-code for your algorithms.
Learning outcomes.
1. Solving Recurrences
2. Greedy Algorithms
3. Divide and Conquer Algorithms
1
1. Solve the following recurrences (Do not use Master theorem)
(a) T(n) = T(n/2) + cn2
(b) T(n)=T(n/2)+T(n−1)+c
(c) T(n) = 3T(n/3) + cn
2. Given a connected graph G where edge costs are pair-wise distinct, prove or disprove that
the G has a unique MST.
3. Lets consider a long, quiet country road with houses scattered very sparsely along it. (We can picture the road as a long line segment, with an eastern endpoint and a western endpoint.) Further, lets suppose that despite the bucolic setting, the residents of all these houses are avid cell phone users. You want to place cell phone base stations at certain points along the road.
Assume the country road has mile-markers: 0 at the extreme west end of the road and N at the extreme east. Each house hi denotes the mile at which it is located. For instance, hi = k means the i-th house is k miles from the west end of the road. Also assume that each base station has a range of R miles. That is, if the base station is placed at t miles from the west end, then all houses |t − hi| ≤ R are covered by that base station.
Give an efficient algorithm that achieves the goal of covering all houses, using as few base stations as possible. Prove the correctness of your algorithm.
4. Suppose you’re consulting for a bank that’s concerned about fraud detection, and they come to you with the following problem. They have a collection of n bank cards that theyve confiscated, suspecting them of being used in fraud. Each bank card is a small plastic object, containing a magnetic stripe with some encrypted data, and it corresponds to a unique account in the bank. Each account can have many bank cards corresponding to it, and well say that two bank cards are equivalent if they correspond to the same account.
It’s very difficult to read the account number off a bank card directly, but the bank has a high- tech “equivalence tester” that takes two bank cards and, after performing some computations, determines whether they are equivalent. Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another?
Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester. Show how to decide the answer to their question with only O(nlogn) invocations of the equivalence tester.
2