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

  Program to evaluate postfix expressions using a stack

Program to evaluate postfix expressions containing complex numbers using a stack. This program should contain two classes. T

  Advantages of contemporary languages allow kinds of comments

Many contemporary languages allow two kinds of comments, one in which delimiters are used on both ends (for multiple line comments), and one in which a delimiter marks only the beginning of the comment.

  Write a report on t linux kernel programming

Write a report on  t Linux Kernel programming.  Giving a brief introduction about Linux in general, then give in details information about Linux Kernel Programming.

  Develop pseudo-code for program to retrieve bytes

Develop the pseudo-code for a program that will retrieve 2 bytes (NUM1 and NUM2) from memory, determine which is closest to the numeric value 50.

  Create application program to declare two circles

Create an application program that declares two circles set radius of one manually but allow the other to use default value supplied by constructor then display each circles values.

  Create unix shell script to input number of hours worked

Create a Unix shell script to input number of hours worked and pay rate and compute the total pay, then the social security amount (assume 5%), then the net pay.

  Wysiwyg editors can be used to learn html

What about fact that WYSIWYG editors can be utilized to learn HTML? As you can usually jump back and forth from their own image.

  Write application that inputs a telephone number as string

Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should String method split to extract the area code as a token.

  Program to read employee information into array of objects

Consider a program that will read employee information into an array of objects, sort the array by employee identification number, write out the sorted array.

  Computing average net profit per sale of product

Your company bought 250,000 online advertising impressions and made average net profit per sale of product of $5.

  Program to simulate rolling one die

Write a program which simulates rolling one die using the following steps: Prompt the user for the number of sides on the die.

  Develop logic for program to read customer records

Develop the logic for a program that reads in 100 customer records and stores the first and last name and total purchases in three parallel arrays.

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