Question: In JAVA, Write a program to solve the Vegetarians and Meat Eaters problem. Three vegetarians and three hungry meat-eaters need to cross a river. Unfortunately,

"In JAVA, Write a program to solve the Vegetarians and Meat Eaters problem. Three vegetarians and three hungry meat-eaters need to cross a river. Unfortunately, the boat only holds two people. If the meat-eaters outnumber the vegetarians on either bank, the vegetarians will be eaten! Your challenge is to find a series of moves that gets all three vegetarians and all three meat-eaters across the river safely. Write a program that solves the vegetarians and meat-eaters problem. You are given broad leeway on how to represent this problem. Recursion and backtracking (depth-first search) is one way to solve this."

If I can only ask one then what is a general outline of this problem, how would I illustrate the people and the boat and the decisions?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!