Dijkstra and Shortest Path Algorithms - Complexity Analysis

Download Q&A
Q. If a graph has V vertices and E edges, what is the worst-case time complexity of Dijkstra's algorithm using an adjacency matrix?
  • A. O(V^2)
  • B. O(E log V)
  • C. O(V + E)
  • D. O(V^3)
Q. In Dijkstra's algorithm, what does the priority queue store?
  • A. All vertices
  • B. Only visited vertices
  • C. Only unvisited vertices
  • D. Only the shortest path vertices
Q. In which scenario would you prefer Dijkstra's algorithm over Bellman-Ford algorithm?
  • A. When the graph has negative weights
  • B. When the graph is dense
  • C. When the graph has non-negative weights
  • D. When you need to find all paths
Q. What is the primary goal of Dijkstra's algorithm?
  • A. To find all paths in a graph
  • B. To find the shortest path from a source to all vertices
  • C. To sort the vertices
  • D. To detect cycles in a graph
Q. What is the purpose of the 'visited' array in Dijkstra's algorithm?
  • A. To store the shortest path
  • B. To track the vertices that have been processed
  • C. To store the distances from the source
  • D. To hold the edges of the graph
Q. What is the space complexity of Dijkstra's algorithm using an adjacency list?
  • A. O(V)
  • B. O(E)
  • C. O(V + E)
  • D. O(V^2)
Q. What is the time complexity of Dijkstra's algorithm using a priority queue implemented with a binary heap?
  • A. O(V^2)
  • B. O(E log V)
  • C. O(V log V)
  • D. O(E + V)
Q. Which data structure is commonly used to implement the priority queue in Dijkstra's algorithm?
  • A. Array
  • B. Linked List
  • C. Binary Heap
  • D. Stack
Showing 1 to 8 of 8 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely