HW2s

HW2s - order to output the cycle the algorithm should also record the previous visited node of each node.

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 2 Chapter 3 Problem 2: You can either BFS or DFS. Whenever the algorithm visits a node, place a tag on it, indicating that node has been visited before; if the tag is already there, a cycle is detected. In
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: order to output the cycle, the algorithm should also record the previous visited node of each node....
View Full Document

This note was uploaded on 10/08/2010 for the course CS 70 at USC.

Ask a homework question - tutors are online