Recent questions tagged knapsack-problem

0 0 votes
1 1 answer
470
470 views
Arrange the following steps in the correct order to solve the Knapsack problem using Dynamic Programming.Define the base case when the capacity is zero ($0$) or no items ...
0 0 votes
1 1 answer
1.6k
1.6k views
int max(int a, int b) { return (a b) ? a : b; }// Returns the maximum value that can be// put in a knapsack of capacity Wint knapSack(int W, int wt[], int val[], int n){...
7 7 votes
1 1 answer
879
879 views
Consider the following $0-1$ knapsack problem with the item's weight and value given in the table.$$\begin{array}{c|cc} \text{item} & \text{weight} & \text{value} \\\hlin...
0 0 votes
1 1 answer
1.7k
1.7k views
please provide the solution
0 0 votes
1 answers 1 answer
2.7k
2.7k views
Consider the following items with their associated weights and values. If a knapsack of capacity 25 units of weight is available and we are allowed to take either the ite...
0 0 votes
1 answers 1 answer
973
973 views
The following table givens the frequency of 4 letters in a database of textIf Huffman encoding is used to encode the word “aaabca” the number of bits required for it is g...
0 0 votes
1 1 answer
710
710 views
1 1 vote
1 1 answer
1.1k
1.1k views
Which of the following is a correct time complexity to solve the $0/1$ knapsack problem where $n$ and $w$ represents the number of items and capacity of knapsack respecti...
2 2 votes
2 2 answers
9.5k
9.5k views
The Knapsack problem belongs to which domain of problems?OptimizationNP completeLinear SolutionSorting
1 1 vote
2 2 answers
3.6k
3.6k views
$0/1$-Knapsack is a well known problem where, it is desired to get the maximum total profit by placing $n$ items (each item is having some weight and associated profit) i...
0 0 votes
0 0 answers
1.0k
1.0k views
In 0/1 knapsack problem ,suppose if maximum weight is given as W and we are asked to find out max profit then * IS IT NECESSARY THAT THE TOTAL WEIGHT SHOULD BE EXACTLY EQ...
0 0 votes
1 1 answer
1.0k
1.0k views
Can we solve fractional knapsack using dynamic programming?
0 0 votes
0 0 answers
808
808 views
Is there any better approach to solve 0/1 knapsack problem other than tabular method ? as it consumes a lot of time when greater number of objects are given.
0 0 votes
1 1 answer
1.5k
1.5k views
Maximum profit using 0/1 Knapsack with W=200 is there any other than brute force method to solve this??? or we have to do only with tabular method?please solve and mentio...
0 0 votes
1 1 answer
814
814 views
What is the best way to solve a 0/1 knapsack problem? Any trick to solve it without wasting much time?Not How to
1 1 vote
1 1 answer
874
874 views
0 0 votes
0 0 answers
325
325 views
How to solve fractional knapsack problem using heap ?
0 0 votes
1 1 answer
1.4k
1.4k views
What will be the time complexity if fractional knapsack is implemented using min heap instead of sorted arraya) O(nlogn)b)O(n^2)c)O(n)d) none of these
0 0 votes
1 1 answer
1.0k
1.0k views
Is fractional Kanpsack or knapsack problem in our GATE 2019 Syllabus
0 0 votes
0 0 answers
1.4k
1.4k views
Read the following statements about 0/1 Knapsack problem.(i) Time complexity of Knapsack is O(n* W) where W is the weight of the Knapsack and there are n items.(ii) Time ...
0 0 votes
1 answers 1 answer
9.2k
9.2k views
The following Knapsack bag. The Knapsack bag maximum Capacity is 50. Find out the maximum profit for Fractional Knapsack. PQRSTUVWWeight1812161416201015Profit341522161722...
1 1 vote
0 0 answers
853
853 views
In the knapsack problem we are given a set of n items, where each item i is specified by a size si and a value vi. We are also given a size bound S (the size of our knaps...
2 2 votes
1 answers 1 answer
1.6k
1.6k views
Example 2.2 : Consider that there are three items. Weight and profit value of each item is as given below,\begin{tabular}{|c|c|c|}\hline $\mathbf{i}$ & $\mathbf{W}_{\math...
1 1 vote
1 1 answer
3.4k
3.4k views
5.Consider the Knapsack instance with 5 objects and a capacity M=11, profit P=(5,4,7,2,3) andweight W=(4,3,6,2,2.). Solve it using dynamic programming approach.
1 1 vote
1 1 answer
652
652 views
how is 0/1 knapsack time complexity O(2^n/2) ?
0 0 votes
1 answers 1 answer
738
738 views
Consider the following instance of the knapsack problem :$\begin{array}{|c|c|c|c|c|c|} \hline \text{Item} & a & b & c & d & e \\ \hline \text{Benefit} & 15 & 12 & 9 & 16 ...
0 0 votes
1 answers 1 answer
5.3k
5.3k views
Consider the following instance of the knapsack problem: n=3 , W=50 , (v1,v2,v3) = (60,100,120) and weight (w1,w2,w3) = (10,20,30) .solve the given knapsack problem apply...