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
Specifically describe the design process for an Android phone application.
topjm [15]

Answer:

 The designing process of the various android applications is basically done by the XML and then, it is replaced by the HTML in the upcoming years. The XML is used as designing the front end applications in the android.

Wire-framing is the basic process of designing the various type of android applications and its is also called as creating the blueprint in the screen of android application.

The various step of designing the android phone application are as follow:

  • Firstly, define the actual reason of designing the app and then developed the app according to their actual requirement.
  • We must make a background research about the app so that we can innovate something new application to make this application more efficient and reliable.
  • Then, designing the app according the specific requirement and create the proper layout design. Then, build a proper prototype of the application.

7 0
3 years ago
How does electricity work in phones?
kati45 [8]
Great Question! So the plug will go into the wall and electricity will hit the cord and power through the cord into the charger (Cordless) Now if you talking mobile phones such as iPhones. The battery powers wire and hardware to power your little mobile phone! Hope this helps.
8 0
3 years ago
How do I copy and paste equations and pictures like math graphs, to post on this site to help get my questions answered?
Mandarinka [93]
Screenshot the math problem and attach it here
5 0
3 years ago
Read 2 more answers
Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
Sav [38]

Answer:

Selection of answers:

Yes, she can navigate the window and do simple editing.

Yes, she can use this application for free and navigate the window.

No, her document is “Read-Only,” so she cannot navigate the window.

No, her application has limited features and she cannot access the document.

Answer is: No, her document is “Read-Only,” so she cannot navigate the window.

3 0
3 years ago
What is cloud based LinkedIn Automation?
Zielflug [23.3K]

Answer:

The cloud-based LinkedIn automation tool makes life easier for you by automating functions like sending connection requests, liking and commenting on posts, sending customized messages, and much more.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Anna always has a hard time finding files on her computer because she does not know where she saved them. This also affects her
    12·2 answers
  • The main devices in a rectifier are:
    14·2 answers
  • Files with what two file extensions are commonly known as tarballs??
    8·1 answer
  • Explain any 10uses of computer that are specific to your field of study giving appropriate examples​
    13·1 answer
  • What are the 4 features of the month-end review tool in quickbooks online accountant?
    14·1 answer
  • Please answer soon
    8·1 answer
  • it just said i was blocked from brainly for a sec i was like- dang- then i logged in again then it was back to normal uHhHh can
    8·2 answers
  • Which of the following statements about ip addresses is true?
    5·1 answer
  • Difference between Data and information​
    10·1 answer
  • Name various input and output devices used with computers.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!