mehboobali98 / Binary-Knapsack-Problem-DP

It is a classic dynamic programming problem in which we have to collect items in the knapsack in such a way that our profit is maximized. The difference between this problem and the fractional knapsack one is that you CANNOT take a fraction of an item.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binary Knapsack Problem Dynamic Programming

It is a classic dynamic programming problem in which we have to collect items in the knapsack in such a way that our profit is maximized. The difference between this problem and the fractional knapsack one is that you CANNOT take a fraction of an item.

Approach

The algorithm to solve the problem has been implemented in three ways:

  • recursive
  • top-down
  • bottom-up (Dynamic Programming)

Time Complexity

The time complexity of the dynamic programming solution is: O(N^2)

Directory Structure

📦Binary-Knapsack-Problem-DP
┣ 📜main.cpp
┗ 📜README.md

About

It is a classic dynamic programming problem in which we have to collect items in the knapsack in such a way that our profit is maximized. The difference between this problem and the fractional knapsack one is that you CANNOT take a fraction of an item.


Languages

Language:C++ 96.5%Language:CMake 3.5%