Programming in Python, Quiz 2
Which of the following statements is/are correct about Dijkstra's algorithm to find the shortest path? I. The shortest path returned by Dijkstra's algorithm always passes through the least number of vertices. II. To decide which vertex to visit next, Dijkstra's algorithm selects the vertex with the minimum known distance among all unvisited vertices.
Which of the following statements is/are correct about Dijkstra's algorithm to find the shortest path? I. The shortest path returned by Dijkstra's algorithm always passes through the least number of vertices. II. To decide which vertex to visit next, Dijkstra's algorithm selects the vertex with the minimum known distance among all unvisited vertices. The Bellman–Ford algorithm can be used to detect the presence of a negative-weight cycle reachable from the source vertex in a weighted directed graph. Which of the following correctly explains how Bellman–Ford detects a negative-weight cycle? Which of the following correctly represents the final max-heap after inserting elements 1, 2, 3, 5, 7, 6, and 4 in the given order one by one, starting with an empty heap? Note:- Ensure that the max-heap property is maintained after each insertion.