Order Of Compilation
1. You are given a directed acyclic graph. The vertices represent tasks and edges representInput Format
dependencies between tasks.
2. You are required to find and print the order in which tasks could be done. The task that should be
done at last should be printed first and the task which should be done first should be printed last.
This is called topological sort. Check out the question video for details.
Topological sort > A permutation of vertices for a directed acyclic graph is called topological sort if
for all directed edges uv, u appears before v in the graph
Note > For output, check the sample output and question video.
Input has been managed for youOutput Format
Check the sample outputQuestion Video
NoneSample Input
7Sample Output
7
0 1
1 2
2 3
0 3
4 5
5 6
4 6
4
5
6
0
1
2
3

Asked in Companies

Related Topics
Video Solution
Code Solution
{ }
{ }
Run