Three Ways To Break
You have a working heap Dijkstra: visited[v] is set when v is popped, popped vertices are skipped, and edges relax with if (dist[v] + w < dist[to]). Input weights are positive integers.
More than one option applies. Which of these changes can make it return a wrong distance?
Sign in to answer questions and track your progress
Sign In