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]
3 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]3 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
Which fund classification would a focus on only stocks of technology companies match?
Bumek [7]

Answer:

Growth funds

Explanation:

This funds fucos on capital appreciation

5 0
3 years ago
Which loan type requires you to make loan payments while you’re attending school?
Levart [38]
<span>A:Unsubsidized federal loan</span>
7 0
3 years ago
ANSWER ASAP!!! 12 POINTS!!!!! RIGHT ANSWERS ONLY
suter [353]

Answer:

B.

Explanation:

8 0
2 years ago
Read 2 more answers
Consists of forging the return address on an email so that the message appears to come from someone other than the actual sender
Pavlova-9 [17]

Answer:

C. Spoofing.

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

Some examples of cyber attacks are phishing, zero-day exploits, denial of service, man in the middle, cryptojacking, malware, SQL injection, spoofing etc.

Spoofing can be defined as a type of cyber attack which typically involves the deceptive creation of packets from an unknown or false source (IP address), as though it is from a known and trusted source. Thus, spoofing is mainly used for the impersonation of computer systems on a network.

Basically, the computer of an attacker or a hacker assumes false internet address during a spoofing attack so as to gain an unauthorized access to a network.

4 0
3 years ago
In which state of matter is there no particle motion?
kiruha [24]
Solid is your answer for the day
6 0
3 years ago
Other questions:
  • Why do computers need to periodically check the dns for websites you have already visited? enter your answer here?
    15·1 answer
  • Which term is used to describe the science of examining raw data, removing excess noise from the dataset, and organizing the dat
    15·1 answer
  • Olivia creates a personal budget. She enters her current savings account balance in cell D3. In cell A3, she calculates her inco
    8·1 answer
  • In what ways do you think the media should function in a democratic society?
    9·1 answer
  • Which role involves designing and creating advertisements for marketing purposes?
    14·1 answer
  • What is the next line?
    6·2 answers
  • A buffer storage that improve computer performance by reducing access time is​
    13·1 answer
  • What function is used to return the results in column D?
    11·1 answer
  • Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and
    12·1 answer
  • Sino ang pinaka matalino sa math sa buong mundo​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!