7.4. Quiz

This section provides exercises for better understanding in disjoint sets.

Implementation

  • Create the GraphQuizarrow-up-right class under the grapharrow-up-right package.

  • Update the numberOfCycles() method that returns the number of all cycles in the graph.

  • Make sure to find all atomic cycles; do not count cycles that can be created by simply combining other cycles.

Report

Write a report quiz6.pdf that includes the followings:

  • Explain the worst-case complexity of the algorithm for your numberOfCycle() method.

  • For the topological_sort()arrow-up-right method in the Graph class, explain why the condition for the exception indicates that the graph includes a cycle.

Last updated

Was this helpful?