Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Why Greedy? | Greedy Algorithms: Overview and Examples
Greedy Algorithms using Python
course content

Зміст курсу

Greedy Algorithms using Python

Greedy Algorithms using Python

1. Greedy Algorithms: Overview and Examples
2. Greedy on Arrays
3. Greedy on Graphs

Why Greedy?

Why Greedy?

The aim of the Greedy approach is to reach the optimal solution as fast as possible. It may be optimal in some cases, but we can’t always guarantee that this is the best solution. The greedy search may be faster and simpler than the correct solution, that’s why it is used instead of a more complex one.

The examples are searching optimal paths on graph problems. In The Travelling Salesman Problem, the point is to find the shortest path to connect all the cities, and each city must be visited only once. This problem has no solution, and we can try to apply some greedy approach: for each new city, select the nearest unvisited city, for example. But we can’t prove or guarantee that a found solution will be optimal.

The Dijkstra algorithm from the last chapter reaches the optimal solution, but only for positive-weighted edges, and we can’t guarantee it for negative-weighted edges.

Anyway, the Greedy approach is common-used and applicable, and we’ll solve some problems with it.

Close-packing of equal spheres problem is one of the unsolved problems where the Greedy approach isn’t applicable. There are known solutions only for dimensions of size 1, 2, 3, 8, and 24.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 1
toggle bottom row

Why Greedy?

Why Greedy?

The aim of the Greedy approach is to reach the optimal solution as fast as possible. It may be optimal in some cases, but we can’t always guarantee that this is the best solution. The greedy search may be faster and simpler than the correct solution, that’s why it is used instead of a more complex one.

The examples are searching optimal paths on graph problems. In The Travelling Salesman Problem, the point is to find the shortest path to connect all the cities, and each city must be visited only once. This problem has no solution, and we can try to apply some greedy approach: for each new city, select the nearest unvisited city, for example. But we can’t prove or guarantee that a found solution will be optimal.

The Dijkstra algorithm from the last chapter reaches the optimal solution, but only for positive-weighted edges, and we can’t guarantee it for negative-weighted edges.

Anyway, the Greedy approach is common-used and applicable, and we’ll solve some problems with it.

Close-packing of equal spheres problem is one of the unsolved problems where the Greedy approach isn’t applicable. There are known solutions only for dimensions of size 1, 2, 3, 8, and 24.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 1
toggle bottom row

Why Greedy?

Why Greedy?

The aim of the Greedy approach is to reach the optimal solution as fast as possible. It may be optimal in some cases, but we can’t always guarantee that this is the best solution. The greedy search may be faster and simpler than the correct solution, that’s why it is used instead of a more complex one.

The examples are searching optimal paths on graph problems. In The Travelling Salesman Problem, the point is to find the shortest path to connect all the cities, and each city must be visited only once. This problem has no solution, and we can try to apply some greedy approach: for each new city, select the nearest unvisited city, for example. But we can’t prove or guarantee that a found solution will be optimal.

The Dijkstra algorithm from the last chapter reaches the optimal solution, but only for positive-weighted edges, and we can’t guarantee it for negative-weighted edges.

Anyway, the Greedy approach is common-used and applicable, and we’ll solve some problems with it.

Close-packing of equal spheres problem is one of the unsolved problems where the Greedy approach isn’t applicable. There are known solutions only for dimensions of size 1, 2, 3, 8, and 24.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Why Greedy?

The aim of the Greedy approach is to reach the optimal solution as fast as possible. It may be optimal in some cases, but we can’t always guarantee that this is the best solution. The greedy search may be faster and simpler than the correct solution, that’s why it is used instead of a more complex one.

The examples are searching optimal paths on graph problems. In The Travelling Salesman Problem, the point is to find the shortest path to connect all the cities, and each city must be visited only once. This problem has no solution, and we can try to apply some greedy approach: for each new city, select the nearest unvisited city, for example. But we can’t prove or guarantee that a found solution will be optimal.

The Dijkstra algorithm from the last chapter reaches the optimal solution, but only for positive-weighted edges, and we can’t guarantee it for negative-weighted edges.

Anyway, the Greedy approach is common-used and applicable, and we’ll solve some problems with it.

Close-packing of equal spheres problem is one of the unsolved problems where the Greedy approach isn’t applicable. There are known solutions only for dimensions of size 1, 2, 3, 8, and 24.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 1
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt