Topological sort using DFS

TC 1, showing WA. Where is the fault??

Here is my code: https://ide.codingblocks.com/s/193684

@sayanwinz this link seems to be blank.

https://ide.codingblocks.com/s/193684

5
A
B
C
D
E
5
C A
D A
B D
E B
E C
Correct output : E B C D A
Your Output: E C B D A
You are not maintaining the order between element which are not related. You will see priority of element before printing.(Use ordered map and sets)


You may refer to this code for seeing how map and set.
@sayanwinz If this resolves your doubt mark it resolved.