!ask I have to use a dfs function and a go function to traverse and topological sort and then print the stages for this graph: G[12] = 1; G[54] = 1; G[23] = 1; G[52] = 1; G[43] = 1; but the output always comes as 3 2 1 4 5 I have used these extra functions void selectSort(int arr[], int n) { for (int i = 0; i finished[arr[minIndex]]) { minIndex = j; }, }, if (minIndex != i) { swap(arr[i], arr[minIndex]); }, }, }, int* topologicalSort(int n) { search(n); int* nodes = new int[n]; for (int i = 0; i < n; i++) { nodes[i] = i + 1; }, selectSort(nodes, n); return nodes; },
u mean backtracing the steps?