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
monitta
3 years ago
14

uppose you are going on a road trip with friends. Unfortunately, your headlights are broken, so you can only drive in the daytim

e. Therefore, on any given day you can drive no more than d miles. You have a map with n different hotels and the distances from your start point to each hotel x 1 < x 2 < ... < x n . Your final destination is the last hotel. Describe an efficient greedy algorithm that determines which hotels you should stay in if you want to minimize the number of days it takes you to get to your destination. What is the running time of your algorithm
Computers and Technology
1 answer:
tiny-mole [99]3 years ago
6 0

Answer:

Explanation:

Algorithm:

a. In each day, you will have to loop through the hotels that come to the hotel after you stayed last night.

b. If a hotel 'h' is found at more than 'd' distance away from last stayed hotel, then the hotel previous of 'h' is chosen to wait for that night. This is the greedy step, and you stay in this hotel.

c. The process for steps a and b is then repeated until we've reached the last hotel xn.

Running time:

Notice that the worst case occurs if each hotel is at a distance of successive multiples of 'd'. The best move is to estimate the distance to each hotel twice the whole computation in the scenario.

Thus, the total running time that could occur in the worst case is O(2n) = O(n). This is said to be linear time.

You might be interested in
For electronically deposited funds, such as an employee's direct deposit, when must banks make those funds available to the empl
Kazeer [188]
I'm in computers class and I would say
6 0
3 years ago
When a user problem cannot be solved by the help desk at the first level of resolution, the problem is ___________ to the second
PIT_PIT [208]

Answer: escalated

Explanation:

7 0
2 years ago
Which of the following operations would best allow you to place 3D building models at their proper height on the terrain (e.g.,
arsen [322]

Answer:

The answer is "Option C"

Explanation:

Base heights are related to it as measurements of height or z-values as they are extracted by mathematics which serves to define the ground of that same world. Once applying a datatype, it can be any entire amount, that will become the level of the function in meters beyond the ground, and wrong choices can be described as follows:

  • In option A, It is a part of extra dimensions object, that's why it is wrong.
  • In option B, It wrong because the offset tool allows the quick and easy offsetting of the lines.
  • In option D, It emphasizes the recovery charts, that's why it is incorrect.
5 0
3 years ago
Which option best explains the goal of computer science?
skad [1K]

Answer:

B correct answer b i think so

8 0
3 years ago
A(n) __________ port, also known as a monitoring port, is a specially configured connection on a network device that is capable
drek231 [11]

Answer:

The answer is "SPAN"

Explanation:

The full form of SPAN port is  "Switch Port Analyzer", which is used to designed specifically for the interface on a network device, that would be able to monitor all traffic passing across the entire device.

  • The use of this port will also call the mirror ports, that is a popular way of gathering data traffic for tracking purposes.
  • It is primarily used to access the bus switch and all interfaces, which is usually accessible from data transmission.
7 0
3 years ago
Other questions:
  • Computers are said to use binary data because all computer data is simply a series of Os and 1s.
    10·1 answer
  • The __________ is a visual or textual storyboard that will assist in determining the type of web pages on your site.
    14·1 answer
  • A lack of financial literacy can cause you to lose your
    10·1 answer
  • A string with delimiters can be parsed into separate fields using the _____ class.
    8·1 answer
  • Which part of the operating system enables you to interact with the device? Question 9 options: The graphical user interface The
    8·1 answer
  • What is the biggest challenge for most business when going online?
    12·1 answer
  • On his website, Mario has a video that visitors must click to play. He wants the video to play automatically when the page loads
    9·1 answer
  • Select the three subjects studied in sports biomechanics.
    9·1 answer
  • What is wrong with the following code?
    7·1 answer
  • if you want to clear a single file, what move instruction would you use? group of answer choices none of the choices file to wor
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!