Computers and Technology

A thief is planning on burglarizing some subset of n consecutive houses in a neighborhood. The houses are labeled 1,2,...,n and the thief will address then sequentially. The thief has an estimate of the profit to be earned from burglarizing each house pi, i = 1...n, where pi > 0. To avoid de- tection, he decides that he will never burglarize two adjacent houses, meaning that if he burglarize house 2, he cannot burglarize house 1 or house 3. Design a dynamic programming algorithm to determine the maximum total profit he can achieve. Example: In each of the following two neighborhoods, the maximum achievable profit is $100: Case 1: p= ($20, $100, $30). Case 2: p= ($40, $30, $10, $60). Your input is the list P1, P2, ...,Pnl.
Your output should be the maximum profit the thief can get. You don't have to return the list of houses the thief has to burglarize to achieve the maximum.
(a) Define the entries of your table in words. E. g., T(i) or T(1,j) is
(b) State recurrence for entries of table in terms of smaller subproblems.
(c) Write pseudocode for your algorithm to solve this problem. d) Analyze the running time of your algorithm.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:30, vane3152
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
image
Computers and Technology, 24.06.2019 11:30, AnwarWeirdLol8811
Why is body language an important factor in a business meeting
Answers: 1
image
Computers and Technology, 24.06.2019 14:30, ari313
Two students are discussing the flow of electricity. student a says that voltage is a measure of the amount of electron flow in a circuit. student b says that power is the product of voltage and current. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
image
Computers and Technology, 25.06.2019 08:10, hinacat87
Why should the technician watch for signs of contamination in the oil when recovering refrigerant from a system
Answers: 3
Do you know the correct answer?
A thief is planning on burglarizing some subset of n consecutive houses in a neighborhood. The house...

Questions in other subjects:

Konu
Mathematics, 03.03.2021 22:20
Konu
English, 03.03.2021 22:20