group of n people are lying on the beach. The beach is represented by the real line R and the location of the i-th person is some integer x; e Z. Your task is to prevent people from getting sunburned...

Computer science
group of n people are lying on the beach. The beach is represented by the real line R<br>and the location of the i-th person is some integer x; e Z. Your task is to prevent people<br>from getting sunburned by covering them with umbrellas. Each umbrella corresponds<br>to a closed interval I = [a, a+ L] of length Le N, and the i-th person is covered by that<br>umbrella if r; e I. Design a greedy algorithm for covering all people with the minimum<br>number of umbrellas. The input consists of the integers x1,..., Xn, and L. The output<br>of your algorithm should be the positions of umbrellas.<br>A<br>For example, if the input is x1 = 1, x2 = 3, x3 = 5, and L = 2, then an optimum solution<br>is the set of two umbrellas placed at positions 2 and 5, covering intervals [1,3] and<br>[4, 6].<br>%3D<br>%3!<br>%3D<br>3<br>4 5 6<br>1<br>2<br>The running time of your algorithm should be polynomial in n.<br>

Extracted text: group of n people are lying on the beach. The beach is represented by the real line R and the location of the i-th person is some integer x; e Z. Your task is to prevent people from getting sunburned by covering them with umbrellas. Each umbrella corresponds to a closed interval I = [a, a+ L] of length Le N, and the i-th person is covered by that umbrella if r; e I. Design a greedy algorithm for covering all people with the minimum number of umbrellas. The input consists of the integers x1,..., Xn, and L. The output of your algorithm should be the positions of umbrellas. A For example, if the input is x1 = 1, x2 = 3, x3 = 5, and L = 2, then an optimum solution is the set of two umbrellas placed at positions 2 and 5, covering intervals [1,3] and [4, 6]. %3D %3! %3D 3 4 5 6 1 2 The running time of your algorithm should be polynomial in n.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here