Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is a greedy algorithm?
Think about local vs global decisions.
Why is it important to sort the bookings by finish time?
Consider how we check for overlaps.
What is the fundamental principle of greedy algorithms?
Think about the nature of greedy decision making.
True or False: Greedy strategies always produce optimal solutions.
Recall the counterexamples discussed in class.
Assume you have the following time slots: [1, 4], [3, 5], [2, 6], [5, 7]. Find the maximum number of non-overlapping intervals using a greedy approach and explain your reasoning.
Sort by finish time and choose accordingly.
Given a larger set of bookings, design and describe a more efficient timeline visualization for the above problem to help quickly identify non-overlapping slots.
Think about graphical representations for clarity.
5 more questions in this section. Enroll free to practise them all.
Enroll free