Zero One Knapsack | Dynamic Programming and Greedy | In English | Java | Video_10

preview_player
Показать описание
Description:

In this video, we start with the famous Knapsack problems and solve the 0-1 knapsack problem where we are required to fill a knapsack with weights up to certain capacity which have the greatest value.

Question Name:
Zero One Knapsack

Question Link:

Question Statement:
1. You are given a number n, representing the count of items.
2. You are given n numbers, representing the values of n items.
3. You are given n numbers, representing the weights of n items.
3. You are given a number "cap", which is the capacity of a bag you've.
4. You are required to calculate and print the maximum value that can be created in the bag without
overflowing it's capacity.

Note1 - Each item can be taken 0 or 1 number of times. You are not allowed to put the same item again and again

5. For more details watch the video.

Topic: #DynamicProgramming #DP #01knapsack

Used #DataStructure: #2DArrays #Recursion #Memoization #Tabulation

#TimeComplexity: O(2^n)

#SpaceComplexity: O(n*c) //where n is the total number of items and c is the capacity of the bag given to us

--------------------------------------------------------------

Smimilar Questions:

1. Unbounded Knapsack:


2. Fractional Knapsack:

--------------------------------------------------------------

Dependent Questions:

1. Unbounded Knapsack:


2. Fractional Knapsack:

--------------------------------------------------------------

More Youtube PlayList:

---------------------------------------------------------------

Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.



We also provide professional courses with live classes and placement opportunities.

.

.

.

Happy Programming !!! Pep it up

----------------------------------------------------------------

#DP #DynamicProgramming #01knapsack
Рекомендации по теме
welcome to shbcf.ru