Course schedule II

Valid Course Schedule

assume we have n courses to schedule, accepted criteria should be :

  • all course have been scheduled.

  • each pair of course should not have dependency on each other

In other words, if we run dfs to find path for each course, there should not be any cycle on dfs path

How could we guarantee we will not miss any one of path?

Do we care about each start node? "no"

eg. course 1 depends on 2, course 2 depends on 3

a course can be scheduled only if

  • it's prerequiste has been scheduled.

we need to mark all courses have been scheduled. and ensure no cycle when schedule “unscheduled" courses.

results matching ""

    No results matching ""