Professional Documents
Culture Documents
Knapsack Problem
Knapsack Problem
Hecne the total time complexity for Knapsak problem = O (n) + O (n log n) + O(n)
As O(n) are very snaller terms Hence time complexity = O (n log n)
Advantages Disadvantages
• There are many advantages to using the • There are a few disadvantages to using the
knapsack problem when trying to solve knapsack problem to solve optimization
problems involving the allocation of problems.
resources. • One disadvantage is that it can be difficult to
• One of the main advantages is that it is very find the optimal solution.
easy to understand and apply. • In addition, the knapsack problem can be
• Additionally, the knapsack problem often time-consuming to solve, and it can be
provides an optimal solution, which means difficult to understand the results
that it is not possible to improve upon the
solution found using this method.
• Finally, the knapsack problem is very efficient,
which means that it can be solved relatively
quickly