-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
What would you like to share?
I propose adding the 0-1 Knapsack algorithm to the repository. This dynamic programming algorithm solves the problem of selecting items with given weights and values to maximize total value without exceeding a weight limit.
Problem Statement:
Given a set of items, each with a weight and a value, determine the maximum value that can be obtained without exceeding a specified weight limit. The 0-1 constraint means each item can either be taken or left (no partial inclusion).
Algorithm Description:
The algorithm uses dynamic programming to build a table that tracks the maximum value achievable for every subproblem, based on item count and weight capacity.
Extra issue details
Language: Go
Category: Dynamic Programming
- Time Complexity: O(n * W) where n is the number of items, and W is the weight capacity of the knapsack.
- Space Complexity: O(n * W) for the DP table.
Additional information
This algorithm is crucial for teaching dynamic programming concepts, and having it in the repository would benefit many learners.