拓扑排序

拓扑排序(topsort)核心思想:不停找入度为零的点不断删去,并更新其他节点入度直到为空。

适用范围:一些满足一定先后关系的活动排序。


例题:

John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is

only possible if other tasks have already been executed.


Input
The input will consist of several instances of the problem. Each instance begins wi

你可能感兴趣的:(算法,图论)