Question
C++ program to solve knapsack 0-1 problem using dynamic programming approach & brute force approach with n =1000 W = 10000 vi = 94 15
C++ program to solve knapsack 0-1 problem using dynamic programming approach & brute force approach with
n =1000 W = 10000
vi = 94 15 67 29 66 53 24 48 35 70 79 68 86 43 51 94 80 98 77 88 38 63 89 9 44 40 18 40 92 44 11 14 9 26 86 82 31 51 71 24 87 17 33 24 25 30 71 69 80 35 68 64 100 15 5 79 20 74 60 15 15 64 44 4 27 61 24 76 95 22 76 97 12 49 33 51 38 1 52 98 87 25 55 75 31 90 72 23 19 13 21 50 79 4 9 4 70 5 19 60 21 75 86 42 47 81 25 7 83 73 9 47 34 20 28 52 61 48 37 23 80 88 57 30 66 53 37 72 19 47 49 71 17 62 23 8 88 6 41 44 74 29 79 72 8 62 2 2 32 19 11 67 36 53 72 100 94 62 26 45 100 85 88 38 48 3 43 100 47 14 35 65 57 3 66 58 10 31 79 68 36 27 19 64 11 3 90 80 98 82 24 17 61 39 47 10 54 17 51 37 35 8 46 16 55 82 10 63 100 11 28 43 83 33 45 66 68 11 94 53 12 27 48 55 67 83 39 66 25 90 24 50 51 78 71 75 41 51 32 5 4 18 2 87 45 45 4 53 83 45 77 60 85 26 12 74 71 80 28 48 93 42 1 64 95 69 64 79 75 60 4 47 20 44 77 97 48 50 7 26 73 2 66 72 2 5 98 44 22 43 5 86 69 33 85 17 79 6 43 39 62 31 84 34 77 57 38 76 33 16 58 56 49 30 62 69 51 46 30 65 33 93 53 33 1 70 100 56 79 11 28 3 88 84 87 19 94 21 67 71 55 6 42 52 24 65 47 91 79 82 96 62 96 50 28 91 78 51 67 79 69 81 78 5 64 16 23 42 92 75 94 91 72 68 44 79 44 46 8 100 96 76 61 58 57 14 29 64 53 10 33 53 1 52 64 53 54 88 56 7 10 25 48 2 54 46 57 93 73 59 31 10 82 24 46 67 26 79 1 86 19 98 19 66 72 29 48 17 15 59 45 99 68 2 65 9 88 52 26 27 6 50 10 36 28 48 86 53 67 45 6 79 92 65 26 76 28 6 86 49 12 46 5 11 37 26 98 96 8 62 83 3 32 73 27 8 82 11 51 23 3 55 38 91 54 87 51 78 64 41 39 96 51 20 35 2 60 42 86 78 11 81 8 81 22 100 41 92 36 25 59 83 14 35 10 61 8 77 66 69 55 26 19 58 82 21 85 69 69 62 28 91 8 31 83 39 80 69 59 94 9 84 43 20 47 54 71 62 82 54 10 38 87 18 28 32 29 29 81 52 66 74 8 100 53 96 85 2 1 2 11 62 80 76 8 54 14 89 6 75 51 95 38 53 13 56 45 2 81 33 83 44 91 58 27 51 12 2 61 78 3 45 100 71 7 32 48 16 8 16 65 39 10 38 84 65 16 43 97 16 16 71 16 51 58 75 94 31 7 52 35 65 68 93 66 7 6 58 54 97 7 94 72 27 58 74 87 17 94 17 79 2 79 60 24 40 75 58 17 80 5 90 16 55 49 28 20 32 12 90 74 14 90 88 64 13 45 87 26 71 47 78 65 84 99 97 93 38 37 73 51 7 75 30 22 10 89 42 96 57 93 41 67 57 47 77 11 47 16 88 14 29 1 15 62 31 64 60 6 37 98 89 51 62 92 4 9 35 11 84 68 80 60 71 18 51 1 97 62 29 21 90 10 85 15 84 53 98 22 61 68 31 15 14 78 4 17 80 27 22 14 75 85 45 15 45 35 94 15 84 79 98 37 80 85 67 34 79 87 12 49 18 52 62 83 45 16 31 11 99 61 100 41 61 75 67 11 19 8 20 25 38 93 6 36 36 5 4 30 67 62 43 44 74 25 8 21 71 37 9 32 81 14 40 52 30 68 64 35 7 62 23 51 88 45 15 74 32 71 87 83 12 44 23 88 22 92 72 71 3 78 56 69 50 71 74 77 57 82 68 9 87 58 19 28 92 55 82 28 96 77 62 48 52 88 51 27 95 16 11 32 59 62 27 54 29 5 78 65 31 31 44 20 74 96 66 23 19 71 60 48 55 17 4 64 80 93 39 27 56 65 72 13 59 41 60 9 53 63 57 10 2 95 74 58 44 61 18 75 74 51 88 66 28 19 33 56 73 56 53 45 42 27 67 26 91 77 11 80 52 95 91 90 98 18 63 88 18 76 39 11 15 19 5 8 11 26 5 67 20 62 92 78 25 54 51 87 85 39 60 97 53 60 98 63 80 61 7 28 100 95 53 87 97 60 44 73 9 100 50
wi = 28 1 23 17 7 6 23 14 21 15 15 3 8 15 25 14 26 19 25 23 20 24 1 17 5 4 25 15 4 18 24 26 11 23 21 18 5 2 11 15 14 7 13 11 12 28 23 26 30 20 23 21 25 20 19 16 3 20 9 25 21 30 14 18 24 28 11 11 27 28 6 8 4 25 21 15 27 15 7 10 3 11 12 22 29 8 14 20 1 12 14 14 10 8 20 2 21 14 20 23 30 3 20 15 24 26 2 3 3 26 9 19 19 28 2 2 10 7 15 23 4 28 29 28 12 3 9 28 1 12 30 21 22 15 3 6 11 12 12 12 22 3 7 25 1 21 23 17 9 18 18 4 19 16 18 19 29 27 18 26 16 25 6 23 7 30 26 23 3 5 7 25 9 9 5 23 8 12 15 2 7 12 5 27 8 14 10 29 12 8 7 16 25 1 16 26 1 13 17 19 27 2 4 28 27 4 12 13 6 20 14 17 29 5 11 1 27 30 16 23 11 7 2 4 1 28 30 14 28 25 11 19 6 5 3 15 15 4 12 9 27 12 3 6 8 26 2 16 23 4 2 13 1 9 5 19 2 28 19 11 16 29 3 2 25 26 11 26 6 7 5 10 23 4 8 14 16 7 22 11 3 26 19 18 21 2 7 20 18 21 3 7 5 29 12 25 22 19 11 26 18 26 13 29 22 12 1 27 23 30 23 17 18 1 27 7 25 17 8 26 18 15 15 27 1 24 29 20 30 30 8 13 30 11 12 23 5 6 24 5 23 14 25 6 1 28 29 12 6 8 20 30 21 17 8 1 8 14 18 20 5 1 14 9 8 4 4 6 21 13 26 13 9 19 21 14 18 13 20 11 15 25 22 9 28 28 4 23 2 28 13 9 1 3 21 5 1 23 10 30 3 4 12 13 27 30 4 13 22 28 1 15 9 16 19 2 10 8 21 22 12 6 3 1 11 1 8 28 21 1 6 18 25 4 1 20 11 29 30 4 16 16 24 13 14 9 8 4 4 7 18 4 8 22 20 27 5 21 17 14 25 2 13 5 23 7 12 2 28 17 26 11 11 8 26 1 13 19 8 14 14 27 7 26 7 5 27 22 1 28 30 6 11 3 3 20 10 26 22 9 12 1 15 21 20 23 1 21 13 29 14 3 30 15 17 1 17 10 11 28 29 27 5 24 6 18 30 24 8 7 10 3 14 25 26 3 10 19 12 7 17 29 18 23 25 11 5 11 25 22 12 9 4 22 9 7 9 29 23 19 15 1 27 11 8 5 8 28 17 4 10 9 17 6 19 29 13 8 8 4 25 5 8 5 10 17 3 25 25 7 15 4 14 20 26 12 11 5 17 18 15 4 29 15 17 29 30 30 27 25 5 24 2 19 4 21 11 3 19 2 8 30 30 21 2 26 16 25 17 20 1 13 29 1 4 22 14 12 24 4 3 11 18 5 22 26 8 18 26 11 2 7 17 29 18 7 22 26 13 16 6 14 2 11 3 21 3 9 11 13 22 23 8 21 20 19 30 22 27 20 10 26 28 18 19 16 23 13 29 6 5 17 17 2 9 18 6 28 19 16 24 12 30 24 11 21 11 11 25 11 11 28 14 9 13 28 16 9 2 17 10 25 19 23 15 11 26 9 11 14 22 23 17 13 29 2 2 16 28 30 15 11 1 27 20 14 14 1 4 24 2 14 28 23 22 16 6 10 5 11 14 26 22 7 22 14 23 30 12 18 27 5 30 9 10 27 1 18 12 25 17 18 10 27 28 15 14 12 13 22 12 25 23 21 9 29 7 26 24 29 26 15 14 14 15 23 27 25 11 1 27 17 29 25 23 11 25 13 15 10 13 7 28 18 24 16 21 22 10 29 29 9 18 9 1 9 27 15 5 2 18 14 1 14 4 15 25 6 1 10 2 10 24 4 6 30 9 22 18 3 2 4 24 27 18 30 4 5 30 26 24 14 16 10 25 11 10 24 27 26 24 27 14 19 21 14 17 11 28 12 18 15 7 11 21 10 8 15 2 28 30 26 8 28 20 18 2 1 7 3 29 30 10 2 21 27 4 28 28 11 7 15 8 7 18 2 17 22 26 12 6 8 19 4 1 18 12 6 9 16 28 11 2 8 27 21 26 11 22 10 21 23 17 3 17 18 17 30 22 29 13 14 5 9 16 17 8 3 19 14 9 23 24 28 7 1 18 23 22 28 6 12 3 18 27 23 3 1 27 8 16 24 16 4 6 14 10 30 1 3
Need in c++ please.. i got the code but its not working with large numbers like these^ ..
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started