Given an array, arr[] and weight W. The task is to minimize the number of Knapsacks required to store all elements of the array. A… Read More

# Tag Archives: knapsack

Given weights and values of N items and the capacity W of the knapsack. Also given that the weight of at most K items can… Read More

Given an integer W, arrays val[] and wt[], where val[i] and wt[i] are the values and weights of the ith item, the task is to… Read More

Given a positive integer K, and an array arr[] consisting of N( =9) integers such that arr[i] represents the cost of the digit (i+1), the… Read More

Given a sac of capacity W, and two arrays A[] and B[] of length N, where A[i] represents the weight of an ith block of… Read More

Rahul and Ankit are the only two waiters in the Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to find the sum of the length of the two… Read More

There are some processes that need to be executed. The amount of load that process causes a server that runs it, is being represented by… Read More

Given an array arr[], consisting of N non-negative integers and an integer S, the task is to find the number of ways to obtain the… Read More

Pre-requisite: Fractional Knapsack Problem Given two arrays weight[] and profit[] the weights and profit of N items, we need to put these items in a… Read More

Given N items with weights W[0..n-1], values V[0..n-1] and a knapsack with capacity C, select the items such that: The sum of weights taken into… Read More

Given S stacks of length M, the task is to maximize the sum of elements at the top of each stack by popping at most… Read More

Given N items, each item having a given weight Ci and a profit value Pi, the task is to maximize the profit by selecting a… Read More

Given weights and profits of N items, put these items in a knapsack of capacity W. The task is to print all possible solutions to… Read More

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