🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Knapsack

In plain terms

A classic optimization problem of choosing items for maximum value under a weight limit.

Going deeper

The knapsack problem picks a subset of weighted, valued items to maximize value without exceeding capacity. It's a canonical dynamic-programming problem.

Under the hood

0/1 knapsack is NP-hard but solvable in pseudo-polynomial time via DP; the fractional variant is greedy-solvable.

Examples

Budget allocation, resource scheduling, cargo loading, DP practice.

Think of it like...

Like packing a weight-limited backpack to carry the most valuable combination of gear.

Feedback & Bug Report