Give greedy algorithm to get all n people across bridge

Assignment Help Programming Languages
Reference no: EM1367707

There is a group of n people with speeds s1, ..., sn. They have a conference that starts soon and they must all cross a bridge to get there. All n people begin on the same side of the bridge. It is nighttime and there is only one flashlight. A maximum of two people can cross at one time.

Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown. A pair must walk together at the rate of the slower man's race.

1) Provide a greedy algorithm to get all these n people across the bridge in a fastest way.
2) Describe the algorithm briefly
3) Prove the correctness
4) Give the optimal substructure
5) Analyze the time cost of your schedule.

Reference no: EM1367707

Questions Cloud

What is the least amount time necessary for crossing : A hunter wishes to cross a river that is 1.4km wide and flows with a speed of 5km/h parallel to its banks.
Does this index indicate market power : Zelda Manufacturing has are unique product that sells for $15 per unit and marginal cost is $7.50. Conclude Lerner index for Zelda Manufacturing. Does this index indicate market power.
Phenomenological-grounded theory and ethnographic research : The three kinds of qualitative nursing research methods are phenomenological, grounded theory and ethnographic research.
At what height will stream of water strike the building : A fireman 52 m away from a burning building directs a stream of water from a ground-level fire hose at an angle of 32° above the horizontal.
Give greedy algorithm to get all n people across bridge : Give a greedy algorithm to get all these n people across the bridge in a fastest way. Describe the algorithm briefly. Prove the correctness.
What are the frequencies of next two harmonics : A plane diving with constant speed at an angle of 51.7° with the vertical, releases a package at an altitude of 437 m. The package hits the ground 2.93 s after release. How far horizontally does the package travel.
Changing health care system : What other avenues might better educate the general public on the role and scope of nursing and also the changing health care system.
What are brand extensions : Are brand extensions an important brand-growth strategy or can they endanger brands? Perhaps start with a definition of brand extensions?
Why does inflation affect increase in social security : Why does inflation affect increase in Social Security and or profits. Is this effect a cost of inflation, as article suggests. Why or why not.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write stored function that takes in zipcode as parameters

Write a stored function called zip_exist that takes in a zipcode.zip%Type parameter and returns a Boolean. The function will return TRUE if the zipcode passed into it exists.

  Applications in involve computing various powers of e

The transcendental number, e. Many applications in mathematics involve computing various powers of e. It can be proven that ex = 1 + x/1 + x2/2! + x3/3! + ... for all values of x. Of course, this is an infinite sum.

  Create program to calculate and display number of miles

Create a program to calculate and displays the number of miles per hour over the speed limit that a speeding driver was doing. The program should ask for the speed limit and the drivers speed.

  Program to checks to see if the value of a is valid

Checks to see if the value of a is 0; if it is, the code prints the message "no solution for a=0" and returns from the function.

  Program to write variable declarations and function calls

Write a program whose main function is merely a collection of variable declarations and function calls. This program reads a text and outputs the letters, together with their counts.

  Program to enter up to 20 integers in the array of long

Write down a program which asks user in order to enter up to 20 integers in the array of longs.The program must utilize the function Find_It() in order to situate the integer within the array.

  Examine the boxplot

Examine the boxplot and briefly discuss the overall pattern of electricity usage for the households.

  Explaining data-driven multicast routing paradigm

The data-driven multicast routing paradigm works best on local networks that have low delay and excess capacity, while the demand driven paradigm works best in a wide are environment.

  Development of computer systems track citizens

To help counter terrorism, many countries are planning and development of computer systems that track large number of citizens and their actions.

  Create a main loop to accepts text commands

Using the ADT described in Dale p280-282, implement a FIFO Queue. Then create a main loop that accepts text commands as specified below and executes the appropriate FIFO queue functions.

  Write a program to calculate diameter in centimeters

Write a program to compute the diameter in centimeters of steel rod, aluminum rod, adn copper rod, which can withstand a particular compression load.

  Distinguish class templates and program with heading

Clearly distinguish each class templates and their program with heading. Elaborate each step and give it without errors. Develop classes or class templates for the following.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd