Assignment 4 Solutions - COMP 251 Autumn 2013 Solutions to...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP 251 Autumn 2013 Solutions to Assignment 4 Gheorghe Comanici Prakash Panangaden Question 1 [20 points] This problem is solved using a greedy algorithm, building the solution from east to west. We start with a list of all the houses. Find the westmost house, and place a base station 4 miles to its east . Remove all the houses covered by this station from the list of houses. Repeat the process until the problem has no more houses. Does our solution stay ahead of other solutions? Suppose somebody claims that some other solution S = { s 1 ,s 2 ,...,s k } is a better than our solution T = { t 1 ,t 2 ,...,t r } (where the stations are sorted from west to east). That is, k <r and both S and T cover all houses. Note that both s 1 and t 1 have to cover the west-most house h , but we chose t 1 as the east most point to cover h , therefore t 1 s 1 Assume t i s i . Then it must be the case that all houses covered { s 1 ,s 2 ,...,s i } will also be covered by { t 1 ,t 2 ,...,t i } , so if we add s i +1 to { t 1 ,t 2 ,...,t i } there won’t be any houses uncovered between t i and s i +1 . But we choose t i +1 as large as possible to cover these houses, so it must be the case that t i +1 s i +1 .
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern