Skip to content

Implementation of Knapsack Problem using Greedy Algorithm and Dynamic Programming

Notifications You must be signed in to change notification settings

bushra-muneer/Knapsack-Problem

Repository files navigation

Design-and-Analysis-of-Algorithm

Problem Statement 1:

Knapsack Problem: (Fractional deal Greedy Algorithm Approach)

A thief finds much more loot than his bag can fit. Help him to find the most valuable combination Of items assuming that any fraction of a loot item can be put into his bag.

Problem Description:

Goal: To implement an algorithm for the fractional knapsack problem

Input: First line of input contains the number of items and the capacity of bag. On behalf of number of inputs the next lines contains the value and weight from which the thief need to find the most valuable combination.

Problem Statement 2:

Knapsack Problem: (Dynamic Programming)

You are given a set of bars of gold and your goal is to take as much gold as possible into your bag. There is just one copy of each bar and for each bar you can either take it or not (hence you cannot take a fraction of a bar).

Problem Description:

Goal:To implement an algorithm for the maximum weight of gold that fits into a bag of capacity.

Input: Firstly, asking for max weight and number of capacity available and take inputs for the capacity in the form of list.

References:

https://www.tutorialspoint.com/data_structures_algorithms/greedy_algorithms.htm https://www.hackerearth.com/practice/algorithms/greedy/basics-of-greedy-algorithms/tutorial/ https://www.geeksforgeeks.org/dynamic-programming/ https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10

About

Implementation of Knapsack Problem using Greedy Algorithm and Dynamic Programming

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages