Professional Documents
Culture Documents
Greedy Algo - Documentation
Greedy Algo - Documentation
Divyansh|Jatin|Shruti
Puneeta Ma’am
15 December 2023
Abstract
Greedy algorithms, known for their simple yet effective approach in solving optimisation prob-
lems, make decisions based on the best immediate choice at each step. This paper explores the
fundamental characteristics of greedy algorithms, their working principles, and highlights their
application in real-life scenarios. Specifically, it delves into the Minimum Spanning Tree (MST)
problem as an illustrative example of how greedy algorithms find practical use. The research pa-
per examines Prim's algorithm, a classic greedy approach used to determine the minimum span-
ning tree in graphs. By presenting its algorithmic details, complexity analysis, and a real-life ap-
plication, this paper aims to underscore the significance of greedy algorithms in solving complex
problems efficiently.
Objective
The primary objective of greedy algorithms is to find an optimal solution by making a series of
locally optimal choices, hoping that these choices lead to a global optimum.
Algorithm Overview
Greedy algorithms operate by iteratively making locally optimal choices in a step-by-step man-
ner. At each step, the algorithm selects the best available option without reconsidering or undoing
previous choices. While this myopic decision-making process might not always yield the best
overall solution, it often produces solutions that are reasonably close to optimal and computation-
ally efficient.
• Time Complexity: O(E log V) using priority queues, where E is the number of edges and
V is the number of vertices in the graph.
• Space Complexity: O(V + E) for maintaining data structures.
Conclusion
Greedy algorithms provide solutions to a wide range of problems by making locally optimal
choices at each step. They might not give optimal solution , but they are valuable in numerous
real-life applications, such as finding minimum spanning trees in network design, Huffman cod-
ing in data compression, and scheduling algorithms in operating systems, among others.