Question: algorithm in pseudocode (Pebbles) Let G=(V,E) an undirected graph with designated vertices s1,s2,t1,t2V. Imagine the following game: At the beginning, there are two pebbles sitting
algorithm in pseudocode

(Pebbles) Let G=(V,E) an undirected graph with designated vertices s1,s2,t1,t2V. Imagine the following game: At the beginning, there are two pebbles sitting on the vertices s1 and s2. The game proceeds in rounds, and in each round both pebbles must move along an edge. Moreover, after each round both pebbles must lie on different vertices. The goal is to move the pebbles to the vertices t1 and t2 (it does not matter which pebble ends up on which goal vertex). Design an algorithm testing whether the game can be won, running in time O(n4). Hint: Define a graph G=(V,E) over a vertex set VVV, where each vertex (u,v)V encodes a valid configuration of the game (i.e., the pebbles are currently sitting on u and v ). Add edges to G encoding how the configurations can change by one valid round of the game. Finally, run an appropriate algorithm on G
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
