Wouldn’t detecting a cycle yield the same result with less effort?
Yes, you are correct. However, this approach might not work if you want to print out the orderings as well.
Wouldn’t detecting a cycle yield the same result with less effort?
Yes, you are correct. However, this approach might not work if you want to print out the orderings as well.