Question: Suppose that a circle is a directed graph where the vertices could be numbered from 1 to n (i.e., each vertex could be given a

Suppose that acircleis a directed graph where the vertices could be numbered from 1 ton(i.e., each vertex could be given a unique number), with vertex 1 having one outgoing edge leading to vertex 2 (and no others), vertex 2 having one outgoing edge leading to vertex 3 (and no others), and so on. Vertexnhaving one outgoing edge leading back to vertex 1 (and no others). Please consider that the numbering discussed here is not what might be necessary to have stored in the graph already; the point is that there's a way to look at the vertices, however they're designated, and deduce that they make up a circle.

  1. Think of an algorithm which takes a directed graph and determines if it is or isn't a circle. It does not need to be written in C++ and pseudocode is sufficient to understand the algorithm.
  2. What will be the asymptotic notation for the best-case running time of your proposed algorithm? Briefly describe a situation that would lead to a best-case outcome.
  3. What will be the asymptotic notation for the worst-case running time of your proposed algorithm? Briefly describe a situation that would lead to a worst-case outcome.

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 Programming Questions!