I am trying to find the solution for a problem where i have something like
And I should get the answer as A > B > C > D.
Conditions for this problem
I need to find a solution for this optimally using Java Collections. Any tips/hints are welcome.
Thanks in advance!
It's called a Topological Sort. http://en.wikipedia.org/wiki/Topological_sorting
Given that, you should be able to complete your homework on your own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With