Question

Algorithms question (Please help if you can) There are four people who want to cross a...

Algorithms question (Please help if you can)

There are four people who want to cross a bridge; they all begin on the same side. You have 17 minutes to get them all across to the other side. It is night, and they have one flashlight. A maximum of two people can cross the bridge at one time. Any party that crosses, either one or two people, must have the flashlight with them. (The flashlight must be walked back and forth; it cannot be thrown, for example.)

Each person walks at a different speed:

person 1 ---> 1 minute to cross the bridge; person 2 ---> 2 minutes; person 3---> 5 minutes, person 4 ---> 10 minutes. A pair must walk together at the rate of the slowest person. For example, if person 1 and person 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If a person 4 returns a flashlight then, a total of 20 minutes have passed, and you failed the mission.

Describe one of the possible algorithms in words.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

person 1 ---> 1 min

person 2 ---> 2 min

person 3 ---> 5 min

person 4 ---> 10 min

first person 1 and 2 will cross : total time 2 min

One will return and then person 3 and 4 will cross : total time = 1 min for person 1 to return + 10 minutes to 3 and 4 to cross = 13 minutes

Now person 2 will return from other side and take person 1 with him = 17 min total

P1 P2 P3 P4 -------------------------------  

P3 P4 ---------------------------------- P1 P2 : 2 min

P1 ---------------------------------- P2 P3 P4 : 13 min

P1 P2 ---------------------------------- P3 P4 : 15 min

----------------------------------- P1 P2 P3 P4 : 17 min

Add a comment
Know the answer?
Add Answer to:
Algorithms question (Please help if you can) There are four people who want to cross a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You and four of your classmates are a team on Survivors. You must cross a chasm...

    You and four of your classmates are a team on Survivors. You must cross a chasm that is twenty feet wide using the following materials and some information given to you on a 3x5 card. The reward to get across the ravine is great, however nobody wants to lose their life crossing. Since you took Emch 213 way back in college, you must convince them that you can design a safe passage across for the five of you and a...

  • Question 2 1 pts Which of the following statements is a sub-claim: Dogs help you keep...

    Question 2 1 pts Which of the following statements is a sub-claim: Dogs help you keep fit. For instance, a pilot study done by Australian researchers reported in the Sydney News 2016 determined that dog owners laugh significantly more frequently than cat owners. According to Pet Owners.com, since dogs need walks, people become more physically fit because they walk approximately 1 mile more a day. Walking a dog PROVES that people will get more exercise; therefore helping people to become...

  • Can you please help me with this question ? The show e r cross the course...

    Can you please help me with this question ? The show e r cross the course the VE) 24ts) THATANE HB ol i į 3 4 5 If the component is an inductor with the value on your spreadshest, and the following a. 4 points) The current through the inductor when 15 b. (4 points) The Gument through the inductor what=36 4 points) The current through the inductor when t=5 Now the component is a capacitor with the value on...

  • In this problem, your goal is to identify who among a group of people has a...

    In this problem, your goal is to identify who among a group of people has a certain disease. You collect a blood sample from each of the people in the group, and label them 1 through n. Suppose that you know in advance that exactly one person is infected with the disease, and you must identify who that person is by performing blood tests. In a single blood test, you can specify any subset of the samples, combine a drop...

  • 4. Imagine you have a job registering people to vote, and you need to register one...

    4. Imagine you have a job registering people to vote, and you need to register one more person before the end of the day. Based on your work thus far, you know that each person you approach has a **4% probability** of registering to vote with you. What is the **expected number of people** you need to approach before you're likely to get someone to register? Please also include the **standard deviation** around your estimate, and describe how you arrive...

  • 4. The question, "Do you smoke?" was asked to 100 people. Results are shown in the...

    4. The question, "Do you smoke?" was asked to 100 people. Results are shown in the table. 11 44 55 33 45 77 100 Pick a person randomly from the 100 people. Denote the event F "the person is female", and Y "Yes, the person smokes". Find the following conditional probabilities: a). P(Y) b). P(YIF) 5. Suppose you have two Bags, each contains 100 marbles: Bag 1 has 70 red and 30 blue marbles; Bag 2 has 60 red and...

  • HI, I NEED HELP ANSWERING PART C OF THIS QUESTION There is a series of people...

    HI, I NEED HELP ANSWERING PART C OF THIS QUESTION There is a series of people standing in a line, from left to right. We’d like to reason about them using predicate logic. We have two predicates: End(x) which is true only if person x is standing at one of the two ends of the line, and LeftOf(x,y) which is true if person x is standing to the left of person y. We won’t use a RightOf(x,y) predicate, but rather...

  • 1. Consider the following scenario: You see a runaway trolley moving toward five tied-up people Iving...

    1. Consider the following scenario: You see a runaway trolley moving toward five tied-up people Iving on the man track Standing next to a lever that controls a switch. There is no time to untie the people. If you tied-up people lying on the main track. You are lever, the trolley will be redirected onto a side track and the five neople on the mana e saved. However, there is a single person Iving on the side track. You have...

  • Please help me as soon as you can! Thank you soooooo much! Exercice 3: Rhesus factor,...

    Please help me as soon as you can! Thank you soooooo much! Exercice 3: Rhesus factor, is a type of protein found on the outside of red blood cells. The protein is genetically inherited. A donor is said to have Rh+ blood if the Rhesus factor is present in their blood. Suppose that a blood donation campaign is launched by the University of Ottawa walk-in clinic. Among undergraduate students donating blood to walk-in clinic, 30% have Rh+. 1. If seven...

  • Leaders who want to take the next step in their career can follow a straightforward four-step cro...

    QUESTION 1. 2. Describe the fourth step in the leadership cross-training process. Leaders who want to take the next step in their career can follow a straightforward four-step cross-training process. The basic idea behind this cross-training approach is simple yet effective. While the most effective leaders have at least one competency that makes them great and eventually indispensable, it makes little sense to continually work on already great qualities. Instead, leaders can benefit from identifying and developing complementary strengths. Building...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT