GK Question

technology hard mcq

Which algorithm is used to find the shortest path in a graph with non-negative edge weights?

  1. Bellman-Ford
  2. Dijkstra
  3. Floyd-Warshall
  4. Kruskal

Answer: Dijkstra

Dijkstra's algorithm finds shortest paths from a source node to all others in graphs with non-negative weights using a priority queue (O((V+E)log V)). Bellman-Ford handles negative weights; Floyd-Warshall finds all-pairs shortest paths; Kruskal is for minimum spanning tree. Classic graph algorithm for technical exams.

Topic Data Structures
Exam Relevance SSC JE, Banking IT, UPSC