Question: 1. Why cannot a path of size one be a cycle? Cant you have an edge from a vertex to itself? Is that not a

1. Why cannot a path of size one be a cycle? Cant you have an edge from a vertex to itself? Is that not a cycle?

2. In ConcatPath, we compute the first and last tasks in the constructor. What could go wrong if we just computed them when they were needed?

3. In the recursive version of TopologicalSort, we have the following code:

if (!schedule.contains(t)) { return new DegeneratePath(t); }

What is the purpose of this code, and why only return something if the task isnt scheduled?

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