Question: How would you solve this in Java Your friend has gotten lost in the woods. He has called and asked for you to come get
How would you solve this in Java
Your friend has gotten lost in the woods. He has called and asked for you to come get him, but you are very busy and would rather just stay home. You quickly look up a map of the woods. It appears that the woods consist of a small number of clearings, with paths connecting them. You hope that the woods are sufficiently small and simple that your friend can get out easily, even if he is just randomly running around. From your friends description, you can figure out at which clearing he is Assuming that every time he reaches a clearing, he runs in a uniformly random direction including back the way he came and that it takes him exactly one minute to get from clearing to clearing, can you predict how long it will take him to get out on average? Input The first line contains two integers N and M where N is the number of clearings in the woods N and M is the total number of paths between clearings. The clearings are numbered through N such that clearing is the one where your friend is right now and clearing N is the exit of the woods. The next M lines each contain two integers K and L indicating a path between clearing K and clearing L KL
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
