GervinFung / KnapsackProblem

Do you know how to solve the knapsack? Come and find out how to solve Knapsack in 5 different ways. Time/Space Complexity included

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solving 0/1 Knapsack Problem in 5 different ways

NOTE:

  1. Algorithm contains items chosen as well, so the time complexity would be different from conventional algorithms 2. Do correct me if I am wrong

n = Number Of Items && w = Weight of Items

N = Number Of Generations && P = Number Of Populations

Name of Algorithms Best Average Worst Space Complexity
Dynamic Programming Ω(n) Θ(n) O(n) O(n)
Least Cost Branch & Bound O(n) O(n) ~ O(2 ^ n) O(2) O(n)
Memoize Ω(nW log(n)) Θ(nW log(n)) O(nW log(n)) O(nW)
Brute Force Ω(2n ^ n) Θ(2n ^ n) O(2n ^ n) O(n)
Genetic Programming Ω(NP) Θ(NP) O(NP) O(NP)

About

Do you know how to solve the knapsack? Come and find out how to solve Knapsack in 5 different ways. Time/Space Complexity included


Languages

Language:Java 100.0%