-1

Which algorithm for the knapsack problem has a O(2^n*n) complexity?

I've been asked to implement a solution for the knapsack problem.

I'm familiar with programming but not with asymptotic notation.

Can anybody advise me on which algorithm has a O(2^n*n) complexity?

Aaron J Lang
  • 2,048
  • 3
  • 20
  • 27
sia
  • 401
  • 3
  • 8
  • 20

1 Answers1

3

O(n * 2^n) is the performance of the brute force algorithm (= just try all combinations), see http://en.wikipedia.org/wiki/Knapsack_problem#Meet-in-the-Middle_Algorithm

Stefan Haustein
  • 18,427
  • 3
  • 36
  • 51