Question: Write a C++ program called ts.cpp that implements the topological sorting algorithm based on the DFS algorithm . Your program should read an input file
Write a C++ program called ts.cpp that implements the topological sorting algorithm based on the DFS algorithm. Your program should read an input file name and display the starting node(s), popping-off order, and topologically sorted list. In the problem, you can assume that the number of nodes in the input file is less than 100. In the program, your program has to follow our convention (= ascending order). So, your program starts from the node 0 between the two possible starting nodes 0 and 1. And also, you should follow our convention in the DFS algorithm.
Input file format:

This is another sample input file called t2.txt. 00 1 0 0 00 1 0 0 000 1 1 000 0 1 This is a sample run: $ g+t -o ts ts.cpp /ts Enter a filename: C:\\tmp\\t2.txt Start node (s): 0 1 Popping-off order: 4 3 20 1 Topological sort: 1 ->0 2 -> 3 - 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
