Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( Modified from a problem in Algorithms by Jeff Erickson ) Note: this problem will be graded manually. Let G be a connected undirected graph.
Modified from a problem in Algorithms by Jeff Erickson
Note: this problem will be graded manually.
Let be a connected undirected graph. Suppose we start with three coins on three arbitrarily chosen vertices
of and we want to move the coins so that they lie on the same vertex using as few moves as possible. At
every step, each coin must move to an adjacent vertex and all coins move at the same time.
Our goal is to analyze an algorithm that finds the shortest solution to the puzzle.
Algorithm
Step : Build the graph
The graph will represent to positions of all three coints. The vertices of are of the form where
and are vertices of
Given any combination of edges and in there is an edge in from to
Step : Perform BFS search on
Assume that the three coins start at positions and We will perform BFS search on starting at
We will continue until we reach a point where all three coins are at the same location. This is a vertex of the
form where all three vertices in are the same. The depth of this vertex is the length of the solution.
Answer the following questions about the algorithm. You may assume that has vertices and edges.
Step
How many vertices and edges are in the graph Your answer should be in terms of and
How long does step of the algorithm take? You answer should be in terms of and and be written using
bigO notation.
Step
How long does step of the algorithm take? You answer should be in terms of and and be written using
bigO notation.
Overall runtime
How long does it take for the algorithm to run? You answer should be in terms of and and be written
using bigO notation.
please describe the clear explanation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started