Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/codemistic/Data-Structures-and-Algorithms
/ main
Function
main
CPP/Dynamic Programming/0-1_Knapsack.cpp:31–40 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
29
}
30
31
int main() {
32
33
vector<int> wt = {1,2,4,5};
34
vector<int> val = {5,4,8,6};
35
int W=5;
36
37
int n = wt.size();
38
39
cout<<
"The Maximum value of items, thief can steal is "
<<knapsack(wt,val,n,W);
40
}
41
42
/*
43
Output:
Callers
nothing calls this directly
Calls
2
knapsack
Function · 0.70
size
Method · 0.45
Tested by
no test coverage detected