Tag Archives: knapsack

Given a knapsack with capacity C and two arrays w[] and val[] representing the weights and values of N distinct items, the task is to… Read More
Given an integer array, consisting of positive weights “W” and there values “V” respectively as a pair and some queries consisting of an integer ‘C’… Read More
Given the weights and values of n items, the task is to put these items in a knapsack of capacity W to get the maximum… Read More
Given an array of positive elements, you have to flip the sign of some of its elements such that the resultant sum of the elements… Read More
A trip to mystical land is going to be organized in ByteLand, the city of Bytes. Unfortunately, there are limited seats say A and there… Read More
Given an integer array W[] consisting of weights of items and ‘K’ knapsacks of capacity ‘C’, find maximum weight we can put in the knapsacks… Read More
Given an integer array W[] consisting of weights of the items and some queries consisting of capacity C of knapsack, for each query find maximum… Read More
Given three integer n, h and p where n is the number of topics, h is the time left (in hours) and p is the… Read More
Greedy approach: A Greedy algorithm is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the… Read More
Given an array ‘arr’ containing the weight of ‘N’ distinct items, and two knapsacks that can withstand ‘W1’ and ‘W2’ weights, the task is to… Read More
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack.… Read More
There are n people and two identical voting machines. We are also given an array a[] of size n such that a[i] stores time required… Read More
Given a knapsack weight W and a set of n items with certain value vali and weight wti, we need to calculate the maximum amount… Read More
You are given a bag of size W kg and you are provided costs of packets different weights of oranges in array cost[] where cost[i]… Read More
Given the weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the… Read More