Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is a design and analysis algorithm problem Problem 4 (The thief's plan) A thief is planning on burglarizing some subset of n consecutive houses

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
this is a design and analysis algorithm problem
Problem 4 (The thief's plan) 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 pii= 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, ...,Pn). 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() or Ti, 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions