1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sweet [91]
2 years ago
12

leetcode A tourism company is providing boat tours on a river with n consecutive segments. According to previous experience, the

profit they can make by providing boat tours on segment $i$ is known as $a_i$. Here, $a_i$ could be positive (they earn money), negative (they lose money), or zero. Because of the administration convenience, the local community requires that the tourism company do their boat tour business on a contiguous sequence of the river segments (i.e., if the company chooses segment $i$ as the starting segment and segment $j$ as the ending segment, all the segments in between should also be covered by the tour service, no matter whether the company will earn or lose money). The company's goal is to determine the starting segment and ending segment of boat tours along the river, such that their total profit can be maximized. Design a dynamic programming algorithm to achieve this goal and analyze its runtime.
Computers and Technology
1 answer:
Soloha48 [4]2 years ago
3 0

Answer:

OPT[i] : segment that end in i with largest amount N

OPT[0] = 0

OPT[i] = max{OPT[i-1] + ai, 0}

for i from 1 to n

if (OPT[i] > max) {

max = OPT[i]

max_i = i

}

count = 0

for i from max_i to 1

count +=a[i]

if (count== max) {

start = i ;

break;

}

You might be interested in
HELP PLEASE
atroni [7]

Answer: The role of a public relations manager is to keep the image of a celebrity, politician, ect. good so that they can keep their career going while constantly in the eye of the public. Public figures may find this useful because it can help them keep their record clean and have a personal life while also making it seem like they are perfect people to their audience, which in hand can help with business.

Explanation:

5 0
2 years ago
The _______ is a small program run by a computer when first powered on. its primary function is to stabilize the machine and dev
tigry1 [53]
Hello <span>TheCelloAlex1645 </span>

Answer: <span>The BIOS is a small program run by a computer when first powered on. its primary function is to stabilize the machine and devices on the motherboard so that the operating system can be loaded and take control of the computer.


Hope this helps
-Chris</span>
3 0
3 years ago
An isp is a group of updates, patches, and fixes that apply to specific oss.
olasank [31]
<span>The statement that an ISP is a group of updates, patches, and fixes that apply to specific OSs is false.
</span> ISP stands for Internet service provider, while OSS stands for Operations support system.<span> The term ISP denotes a company or</span><span> organization that provides services for accessing, using, or participating in the Internet. OSS on the other hand is used by the providers to manage their networks.
</span>
4 0
3 years ago
Glenda operates an Airbnb business in which she rents an apartment for $150US per night . There is a mandatory deposit of 50 dol
Kipish [7]

Answer:

Steps of the technological design process include: identify a problem, research the problem, generate possible solutions, select the best solution, create a model, test the model, refine and retest the model as needed, and communicate the final solution.

Explanation:

3 0
2 years ago
Nearly all personal computers are capable of serving as network servers.
Mashutka [201]
True
yes computers are capable of serving network servers.
6 0
3 years ago
Read 2 more answers
Other questions:
  • Households pay taxes to the government and receive public services. Which of the following is a public service?
    8·1 answer
  • A _____ is a predefined text format that includes multiple formatting options.
    14·1 answer
  • One purpose of the dual ignition system on an aircraft engine is to provide for?
    7·2 answers
  • Which database is more secure: the java-based apache derby or mysql?
    6·1 answer
  • What is the subnet mask ?
    9·2 answers
  • Can someone that been helping me answer one more question for please and thx
    13·1 answer
  • What is the purpose of this parallelogram shape in a flowchart? O decision process o input or output start or end​
    13·1 answer
  • Which of the following represent features of free software licensing? Check all of the boxes that apply.
    10·1 answer
  • In a black box model are the customers told that they should be expecting to be haxked?
    13·1 answer
  • Requests to retrieve data written in a language such as SQL are called…
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!