Greedy Algorithms Quiz 2

Placewit
2 min readJun 12, 2021

--

Which of the following standard algorithms is not a Greedy algorithm ?

A. Dijkstra’s shortest path algorithm

B. Prim’s algorithm

C. Kruskal algorithm

D. Bellman Ford Shortest path algorithm

Solution :

D) is correct.

Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy algorithms are used for optimization problems. An optimization problem can be solved using Greedy if the problem has the following property: At every step, we can make a choice that looks best at the moment, and we get the optimal solution of the complete problem.Following are some standard algorithms that are Greedy algorithms.1) Kruskal’s Minimum Spanning Tree (MST)2) Prim’s Minimum Spanning Tree3) Dijkstra’s Shortest Path4) Huffman CodingThus Bellman Ford Shortest path algorithm is not a Greedy Algorithm.

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

Placewit
Placewit

Written by Placewit

Upskilling students for tech placements!

No responses yet