30 30 votes Which one of the following algorithm design techniques is used in finding all pairs of shortest distances in a graph? Dynamic programming Backtracking Greedy Divide and Conquer Algorithms gate1998 algorithms algorithm-design-techniques easy isro2008 + – Kathleen 13.4k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 33 33 votes Answer is $(A)$ because Floyd Warshall algorithm is used to find all shortest paths which is a dynamic programming approach. sshekhar94 answered Mar 7, 2016 • edited Jun 24, 2018 by Shikha Mallick sshekhar94 comment Share Follow See all 8 Comments 8 8 Comments reply Show 5 previous comments ankitgupta.1729 commented Oct 6, 2018 reply Follow flag @meghna , running time of Dijkstra's algo depends on which data structure we use to store information... 1) using Array data structure , running time $\in$ $O(|V|^{2})$ 2) using Binary Heap data structure , running time $\in$ $O((|E|+|V|)(lg|V|))$ 3) using Fibonacci Heap data structure , running time $\in$ $O(|E|+|V|(lg|V|))$ 21 21 replyShare Abhrajyoti00 commented Dec 8, 2022 reply Follow flag Giving an insight to @ankitgupta.1729 Sir’s answer from algorithm - The Big O on the Dijkstra Fibonacci-heap solution - Stack Overflow The complexity of Dijkstra's shortest path algorithm is: O(|E| |decrease-key(Q)| + |V| |extract-min(Q)|) For both a Fibonacci heap and a binary heap, the complexity of the extract-min operation on this queue is O(log |V|). This explains the common |V| log |V| part in the sum. In the remaining part of the sum (the one with the edge factor |E|), the O(1) v.s. O(log |V|) difference comes precisely from using respectively a Fibonacci heap as opposed to a binary heap. The decrease key operation which may happen for every edge has exactly this complexity. So the remaining part of the sum eventually has complexity O(|E|) for a Fibonacci heap and O(|E| log |V|) for a binary heap. 2 2 replyShare pavansan commented Dec 31, 2024 reply Follow flag learnt new things from comments thanks buddies 1 1 replyShare Please log in or register to add a comment.
9 9 votes The algorithm is an example of dynamic programming.http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm Mithlesh Upadhyay answered Mar 17, 2015 • reshown Nov 6, 2016 by srestha Mithlesh Upadhyay comment Share Follow 0 reply Please log in or register to add a comment.