Tutorials
Courses
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Greedy
2.1K+ articles
Algorithms
2.0K+ articles
Sorting
1.8K+ articles
Dynamic Programming
1.6K+ articles
Recursion
1.0K+ articles
Branch and Bound
18+ articles
knapsack
40 posts
Recent Articles
Popular Articles
C++ Program for the Fractional Knapsack Problem
Last Updated: 19 July 2020
Pre-requisite: Fractional Knapsack ProblemGiven two arrays weight[] and profit[] the weights and profit of N items, we need to put these items in a knapsack of capacity W ...
read more
Greedy
Competitive Programming
C++ Programs
DSA
STL
knapsack
Greedy Algorithms
Fraction
Count of Ways to obtain given Sum from the given Array elements
Last Updated: 14 June 2021
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 sum S by adding or subtracting array ele...
read more
Algorithms
Dynamic Programming
Divide and Conquer
Searching
Mathematical
Recursion
DSA
Arrays
subset
knapsack
Memoization
Minimum absolute difference of server loads
Last Updated: 10 February 2023
Content RemovedFor similar problem visit: Partition a set into two subsets such that the difference of subset sums is minimum...
read more
Dynamic Programming
Searching
Mathematical
DSA
Arrays
Google
interview-preparation
subsequence
knapsack
Maximum Tip Calculator
Last Updated: 15 February 2023
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 handled by different waiters ...
read more
Dynamic Programming
Hash
Recursion
DSA
Arrays
Amazon
Amazon-Question
interview-preparation
knapsack
Sum of length of two smallest subsets possible from a given array with sum at least K
Last Updated: 06 April 2023
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 smallest unique subsets having sum of its elements at ...
read more
Dynamic Programming
Mathematical
Technical Scripter
Technical Scripter 2020
DSA
Arrays
subset
Suffix-Array
knapsack
suffix-sum
Unbounded Knapsack (Repetition of items allowed) | Efficient Approach
Last Updated: 20 May 2024
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 calculate the maximum value that can be obtain...
read more
Dynamic Programming
Mathematical
DSA
knapsack
Theft at World Bank
Last Updated: 31 January 2023
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 gold and B[i] represents the profit gained by taking...
read more
Greedy
Mathematical
DSA
knapsack
cpp-vector
Construct the largest number whose sum of cost of digits is K
Last Updated: 11 October 2021
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 task is to find the largest numbe...
read more
Dynamic Programming
Mathematical
Recursion
DSA
Arrays
knapsack
Numbers
Maximum sum of values of N items in 0-1 Knapsack by reducing weight of at most K items in half
Last Updated: 27 January 2023
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 be changed to half of its original weight. The ta...
read more
Greedy
Competitive Programming
Recursion
DSA
knapsack
Minimize number of Knapsacks with total weigh W required to store Array containing elements greater than W/3
Last Updated: 17 January 2022
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 single knapsack can store a maximum tota...
read more
Greedy
Sorting
Combinatorial
DSA
Arrays
Quick Sort
knapsack
Maximize cost of segment having weight at most K from given weight and cost of N items
Last Updated: 31 May 2022
Given two arrays W[] and C[] containing weight and cost of N (1 to N) items respectively, and an integer K, find a segment from 1 to N, such that the total weight of the s...
read more
Misc
Greedy
Mathematical
DSA
Arrays
knapsack
sliding-window
Introduction to Knapsack Problem, its Types and How to solve them
Last Updated: 01 October 2024
The Knapsack problem is an example of the combinational optimization problem. This problem is also commonly known as the "Rucksack Problem". The name of the problem is def...
read more
Algorithms
DSA
knapsack
Approximation algorithms for Knapsack
Last Updated: 06 December 2023
Knapsack problems are those problems in which some set of items will be given to us, each with a weight and value and we will be asked to find the most valuable combinatio...
read more
Dynamic Programming
Greedy
Picked
DSA
knapsack
Algorithms-Dynamic Programming
Greedy Algorithms
GFact | Why doesn't Greedy Algorithm work for 0-1 Knapsack problem?
Last Updated: 03 October 2023
In this article, we will discuss why the 0-1 knapsack problem cannot be solved by the greedy method, or why the greedy algorithm is not optimal for the 0-1 Knapsack Proble...
read more
Algorithms
knapsack
Difference Between Greedy Knapsack and 0/1 Knapsack Algorithms
Last Updated: 21 May 2024
The 0/1 Knapsack algorithm is a dynamic programming approach where items are either completely included or not at all. It considers all combinations to find the maximum to...
read more
Algorithms
Dynamic Programming
Greedy
DSA
knapsack
Algorithms-Greedy Algorithms
1
2
3
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !