wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Let G (V, E) an undirected graph with positive edge weights. Dijkstra's single source-shortest path algorithm can be implemented using the binary heap data structure with time complexity?

A
O((|E|+|V|)log|V|)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
O(|V|2)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
O(|V|log|V|)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
O(|E|+|V|log|V|)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D O(|E|+|V|log|V|)
Dijkstra's implementation for single source shortest path

(i) Using binary heap takes

O((|E|+|V|)log|V|)

(ii) Using Fibonacci heap takes

O(|E|+|V|log|V|)

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
System of Linear Equations
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon