Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
Describe what a greedy algorithm does.
Think about making decisions based only on immediate gains.
Give an example of a simple problem suitable for a greedy algorithm.
Consider how you would make change with different coin denominations.
What is a greedy algorithm?
Focus on the idea of immediate benefits or gains.
True or False: Greedy algorithms are guaranteed to always find the optimal solution.
Consider scenarios like the Knapsack Problem.
Given a set of intervals, design a greedy algorithm to find the maximum number of non-overlapping intervals.
Think about how to select the intervals based on their start and end times.
If you were to design a greedy algorithm for the traveling salesman problem, what approach would you take, and how would you prove its efficiency?
Consider how greedy algorithms might not consider future travel needs.
6 more questions in this section. Enroll free to practise them all.
Enroll free