Hello, I am working on bridge and torch problem. I wanted to be sure if I'm doing solving the problem correctly with 5 and 6 people. I'll be glad if you tell me if I'm doing right or wrong.
With 5 people, let's consider we have 5 people with following speeds :
1 2 3 4 5
in this case:
1 and 2 comes out
1 goes back
3 and 4 comes out
2 goes back
1 and 5 comes out
1 goes back
1 and 2 comes out

And with 6 people with following speeds:
1 2 3 4 5 6
in this case :
1 and 2 comes out
1 goes back
3 and 4 comes out
2 goes back
5 and 6 comes out
3 goes back
1 and 3 comes out
1 goes back
1 and 2 comes out

Thanks.

If there is no weight of traveling time for each person, any permutation is correct. However, once you add weight values, then you will see whether or not your algorithm is correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.