I looked at other posts related to this issue but nobody had meaningful answers, so I’m asking here.
So, this problem is basically topological sort.
You’re asked to find if for given graph there exists a unique way to sort it. ( Print it out, if true )
What I am doing is this:
- Search for cycles in graph (This is supposed to tell me if this graph can be sorted)
- If there is a cycle, print “recheck hints” else do topological sorting
- When doing topological sorting, find the maximum number of nodes that have entered queue
- If this max value is 1 print out the sequence otherwise print “missing hints”
Here is my full code, please help! I have been solving this all day