Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Jack Ostrich, a notorious pirate, has come across a single-file convoy of merchant ships that he would like to plunder. Some of these ships, however,

Jack Ostrich, a notorious pirate, has come across a single-file convoy of merchant ships that he would like to plunder. Some of these ships, however, are well defended, and the cost of repairing Jack's ship, the Blue Pearl, after engaging them would amount to more than their treasure is worth. Further complicating measures is the fact that, while Jack can choose any point in the convoy to break off, he cannot return after doing so, and must engage each ship in the convoy up to that point. For example, consider the following convoy:

Then, breaking off the convoy after the second ship would be the best option, as it yields a net profit of 11 (which is the highest possible given this convoy). Assuming that Jack has already calculated the cost or benefit to plundering each merchant ship: (a) Give an 0(n) algorithm that will let him walk away with the maximum net profit. (b) Suppose Jack has hired an expert navigator, and can now choose an interception point as well as a breakoff point. Give an 0(n * log(n)) algorithm that makes the best use of his new ability.

40 40 40 40 40 40 40 40 40 4 5 6 -9 2 -8 4 -7 3 -5 8

Step by Step Solution

3.50 Rating (147 Votes )

There are 3 Steps involved in it

Step: 1

a On All arrays are 1 indexed arrn array of profits and losses of each ship First we find the sum of ... 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

Engineering Economics Analysis

Authors: Ted G. Feller

9th Edition

9780195168075

More Books

Students also viewed these Programming questions

Question

Recognize the causes and symptoms of stress.

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

A car is parked on a steep hill. Identify the forces on the car?

Answered: 1 week ago