Short answer: The fractional knapsack problem allows any fraction of an item. Sort by value per unit weight and take items from the densest until the next item does not fit. Fill the remaining capacity with a fraction of that item. The greedy choice is optimal for the fractional…
Category: Greedy
How activity selection takes the earliest finish
Short answer: Activity selection chooses a largest set of mutually compatible intervals. Sort the activities by finishing time and take the next activity that starts at or after the finish of the last chosen one. The greedy choice is optimal: some maximum set uses an activity that finishes first,…
