### Unit 7: Greedy Algorithms

In this unit, we will look into a common computer science algorithm technique called the greedy algorithms. Like the dynamic programming paradigm, greedy algorithms typically apply to optimization problems in which a set of choices must be made in order to arrive at an optimal solution. The idea of greedy algorithm is to make each choice in a locally optimal manner. We will explore some common greedy algorithms in use today as a way of explaining the topic in this unit.

**Completing this unit should take you approximately 7 hours.**

### 7.1: Introduction to Greedy Algorithms

Read Chapter 5 of S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani's book

*Algorithms*.

### 7.2: Greedy Algorithms - Part I

Watch this video to learn about greedy algorithms.

### 7.3: Greedy Algorithms - Part II

Watch this video to learn about greedy algorithms.

### 7.4: Greedy Algorithms - Part III

Watch this video to learn about greedy algorithms.

Read this article to learn about the mathematical concept behind the idea of recursion.

Complete all questions in this activity. There is one question on the minimum spanning tree problem requiring two implementations using the Kruskal's algorithm and the Prim's algorithm. You can check your answers against the Answer Key.