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
wolverine [178]
2 years ago
6

Professor Gekko has always dreamed of inline skating across North Dakota. He plans to cross the state on highway U.S. 2, which r

uns from Grand Forks, on the eastern border with Minnesota, to Williston, near the western border with Montana. The professor can carry two liters of water, and he can skate m miles before running out of water. (Because North Dakota is relatively flat, the professor does not have to worry about drinking water at a greater rate on uphill sections than on flat or downhill sections.) The professor will start in Grand Forks with two full liters of water. His official North Dakota state map shows all the places along U.S. 2 at which he can refill his water and the distances between these locations. The professor’s goal is to minimize the number of water stops along his route across the state.
a. Give an efficient algorithm by which he can determine which water stops he should make.

b. Prove that your strategy yields an optimal solution, and give its
Computers and Technology
1 answer:
geniusboy [140]2 years ago
8 0

The efficient algorithm by which he can determine which water stops he should make; <em>has been determined below and the strategy which is the greedy strategy has been proven to yield an optimal solution.</em>

<em />

To solve this question optimally, we will make use of the greedy solution.

In this method, we will maximize the distance that can be covered from a particular point in such a way that there must be a place where water can be gotten before a run out is experienced.

Now, the first point at which there will be a stop should be located at a point that is farthest from the starting position and is also made to be ≤ m miles from the starting position.

Now, this this situation is one that shows optimal substructure and since our  first stopping point will be made to be at p, it means that we are solving the sub-question with the assumption that our starting point is at p.

When we combine the two stated plans above, we will arrive at an optimal solution for the normal reasons via cut and paste.

B) Now we need to show that the greedy approach earlier used produce a first stopping point which is contained in the optimal solution.

Let O represent any optimal solution whereby the professor stops at positions o₁, o₂, o₃....oₙ.

Let h₁ represent the farthest stopping point that is reachable from the starting point. Then we can replace o₁ by h₂ to generate a modified solution H since o₁ - o₂ < o₂ - h₁.

Finally, we can really make it to the positions in H without having to run out of water and since H has the same number of stops, we can conclude that h₁   is contained in one of optimal solution.

Therefore our strategy which is the greedy strategy has been proven to work.

Read more about algorithms at; brainly.com/question/24793921

You might be interested in
Write a function called printRange() that accepts two integers as arguments and prints the sequence of numbers between the two a
a_sh-v [17]

Answer:

def printRange(start, stop, steps = 1):

   list1 = []

   if steps > start or stop:

       print("Steps is larger than start and stop value")

       return None

   if int(start) < int(stop):

       while start < stop:

           start = start + int(steps)

           list1.append(start)

       print(list1)

   elif start > stop:

       while start > stop:

           stop = stop + int(steps)

           list1.append(stop)

       print(list1)

   elif start == stop:

       print(start)

   else:

       print("Values are not integers.")

for easier viewing:

https://www.codepile.net/pile/e95verLk

If you need help understanding comment below.

5 0
1 year ago
Who invented computer ?​
liraira [26]

Answer:

Charles Babbage invented computer.

hope this helps!

8 0
2 years ago
Read 2 more answers
Write a program (main method) that advises the user on programming language. So if a user for instance enters "Java" the program
vivado [14]

import java.util.Scanner;

public class JavaApplication41 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       String language = scan.nextLine();

       if (language.toLowerCase().equals("java")){

           System.out.println("Awesome!");

       }

       else if (language.toLowerCase().equals("python")){

           System.out.println("A very simple language!");

       }

       else if (language.toLowerCase().equals("ruby")){

           System.out.println("Are you sure?");

       }

       else if (language.toLowerCase().equals("javascript")){

           System.out.println("Easy enough");

       }

       else if (language.toLowerCase().equals("c")){

           System.out.println("Cool!");

       }

   }

   

}

I hope this helps!

6 0
2 years ago
What are the characteristics of the Global Address List? Check all that apply.
nignag [31]

Answer:

It is the very last statement (bottom). Also copied to the the client

Explanation:

3 0
2 years ago
Help?!<br> Does anyone know how to use Adobe SoundBooth?
Mandarinka [93]
Never heard of that but it probably just have the kind of use of abobe flash
7 0
3 years ago
Read 2 more answers
Other questions:
  • Which data type uses more memory an integer or an unsigned integer?
    6·1 answer
  • How do you create a reference page in apa format with all websites?
    5·1 answer
  • What are the advantages of homogenation
    5·1 answer
  • Differentiate among web apps, mobile apps, and mobile web apps.
    14·2 answers
  • Select the statement that accurately describes why the Italics function is being used in the sentences below.
    8·1 answer
  • In computer logic what is order of instructions
    13·1 answer
  • Which of the following statements about the relationship between hardware and software is true? a) Hardware can be present in in
    9·1 answer
  • PLEASE HELP I WILL GIVE BRAINLIEST!!!!
    7·2 answers
  • Which option should you choose to change the background of your current slide?
    10·2 answers
  • At a family reunion, your cousin takes a picture of both of you with her phone, orders a print of it, and mails it to you with a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!