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
One friend claims that a dual-core system runs at twice the speed as a single-core system; another friend disagrees by saying th
lidiya [134]

Answer:

<u>the first friend</u>

Explanation:

It is important to <em>remember </em>that a core is the brain of the CPU (central processing unit), which means one who has a dual-core is having <em>"a dual brain" </em><em>to process information faster.</em>

Consider also, IT experts often acknowledge that in terms of speed of execution, it is proven that, "dual-core systems" are <em>faster</em> (even twice faster) than a "single-core system". The other friends were wrong because they disagreed with a widely accepted fact that dual-core is faster than single-core; and of course, <em>we know that without them being faster they can't run twice the applications and twice the data. </em>

Therefore, we can make the conclusion that the first friend's response is correct.

5 0
2 years ago
________ is used to install and update software, backup, and restore mobile devices, wipe employer software and data from device
erastovalidia [21]

Answer: MDM softwares

Explanation:

Here MDM refers to mobile device management software which provides people with the facilities of updating, installing creating backup of various mobile devices within an organisation. Moreover these software's provides tools for proper monitoring and to report their usage across various independent mobile device users. MDM is often used or interconnected with the term BYOD(Bring your own device), whereby employees of an organisation bring their own mobile devices and they are being managed by a MDM software centrally.

8 0
3 years ago
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a ____ wh
mart [117]
Although a user directory is treated as a file, it is flagged to indicate to the file manager that this file is really a subdirectory whose records are filenames that point to files.
3 0
3 years ago
What is a program that, when installed on a computer, records every keystroke and mouse click?
Mrac [35]
"Key logger" This could be software or hardware that does this.
6 0
3 years ago
If you create an object using Java’s BigDecimal class, and then perform a division that results in a non-terminating decimal div
azamat

Answer:

Arithmetic Exception is the correct answer to the following blank.

Explanation:

Because the BigDecimal class is the class of the Java Programming Language that deal with the double data type numbers for the arithmetic expressions and also for the format conversions and it is the math type class of the Java Programming language which is used in arithmetic operations. So, that's why the following answer is not wrong.

3 0
3 years ago
Other questions:
  • Weber believed that there is an inevitable destructive quality to which one of the four types of action?
    8·1 answer
  • The Glow effect adds a blinking border around a chart.<br> t or f
    15·1 answer
  • What is the Matlab command to create a vector of the even whole numbers between 29 and 73?
    11·1 answer
  • New Jersey and New York have the highest state taxes in the United States. They also have high ratios of people moving out compa
    13·1 answer
  • In terms of data storage and sharing, in what way, if any, do dropbox services differ from archiving services?
    8·1 answer
  • Create a class named Console, and move all the methods that retrieve and validate user input to that class. These methods can re
    7·1 answer
  • A _________ is automatically launched by some trigger and appears in front of the active window
    12·1 answer
  • Which of the following items can you locate in a document using the navigation pane? Choose the answer.
    10·1 answer
  • Who has more Tanks? Russia or USA? You get ti right and you get BRAINLIEST
    12·2 answers
  • You need to install Windows on a new computer. You also need to replace a motherboard in another computer, and both tasks need t
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!