5 votes 5 votes Which of the following is/are correct with respect to Dijkstra's algorithm to find Single Source Shortest Path in a weighted directed graph $G$? (Mark all the appropriate choices) Dijkstra's algorithm runs in $O(|E| \lg |V|)$ if priority queue is implemented with a binary min-heap For dense graphs $(|E| = \Omega(|V|^2))$ Dijkstra's algorithm performs better if priority queue is implemented with an array Dijkstra's algorithm has a worst case time complexity of $O(|V|^2)$ Dijkstra's algorithm has a worst case time complexity of $O(|V|\lg |V| + |E|)$ when implemented with a Fibonacci heap Algorithms go2025-algorithms-2 shortest-path multiple-selects + – gatecse asked Sep 7, 2020 • edited Sep 7, 2020 by soujanyareddy13 gatecse 465 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Quantum City commented Oct 8, 2023 i edited by Quantum City Dec 30, 2023 reply Follow Share @gatecse Answer should be A, B, D. Dijkstra’s algorithm has a worst case time complexity when there is a dense graph and priority queue is implemented with priority heap. It comes out to be $O(V^2 logV)$. Plz correct me if I’m wrong. Why should the answer be C as well ? - because when nothing is given about implementation of algorithm and question asks about worst case then we take worst case time complexity of optimal algorithm. This answers my question. Thanks for reading 🙏 5 votes 5 votes Harsh Saini_1 commented Jan 12 reply Follow Share @Quantum City So when we’re using the Optimal algorithm shouldn’t we be using the optimal data structure as well which is Fibonacci Heap which will give us the Worst Case Time Complexity as $O(V\log(V) + E)$ 1 votes 1 votes Please log in or register to add a comment.
2 votes 2 votes All the given statements are correct. When nothing is mentioned about the data structure to be used we can assume the best possible data structure. gatecse answered Sep 7, 2020 • edited Dec 28, 2023 by Arjun 1 flag: ✌ Edit necessary (Arjun) gatecse comment Share Follow See all 17 Comments See all 17 17 Comments reply Show 14 previous comments naveen_168 commented Nov 30, 2021 reply Follow Share Option c is quite unclear to me. Please anyone explain how is it correct. I think not much of the information has been given to derive conclusion. 2 votes 2 votes samarpita commented Oct 17, 2022 reply Follow Share @Arjun @Sachin Mittal 1 @gatecse sir,For option C if it is implemented using Fibonacci heap and adj matrix, then the time complexity will be (O(V^2)).But if it is implemented using binary min-heap + adj matrix, then the time complexity will be O((V^2)lgV). So, sir it is not told which implementation to follow, then how we can say this is true. 0 votes 0 votes Tmajestical commented Oct 29, 2022 reply Follow Share @Arjun @Sachin_Mittal_1 @gatecse sir, In option B, should we interpret “if priority queue is implemented with an array” as array being a sorted array? I’m asking because, i’m not sure if a normal array can be a priority queue. 0 votes 0 votes Please log in or register to add a comment.