New answers tagged

0 votes

Why do we do topological sorting to find shortest or longest path in weighted DAG?

Toposort also work as a visited array and prevent from getting into a cycle where every time your distance increase 0 ---> 2 ---> 0 Now, you are thinking why don't we use a visited array instead ...
user avatar
  • 1

Top 50 recent answers are included