Lab assignment-2
Lab assignment-2
Lab Assignment 2
Given the weights and profits of N items, in the form of {profit, weight},
Input: arr[] = {{60, 10}, {100, 20}, {120, 30}}, put these items in a knapsack of
capacity W= 50 to get the maximum total profit in the knapsack. Use Fractional
Knapsack, and break items for maximizing the total value of the knapsack.
Huffman Coding is a lossless data compression algorithm. The algorithm assigns
variable-length codes to input characters, with shorter codes assigned to more frequent
characters. Write a program to implement Huffman Coding. Given a string as input,
your task is to:
Additional Questions:
https://www.interviewbit.com/problems/majority-element/
https://www.interviewbit.com/problems/distribute-candy/
https://www.hackerearth.com/practice/algorithms/greedy/basics-of-
greedy- algorithms/tutorial/ [Solve the problem available at the end]
https://www.codechef.com/problems/SUBSEG2
https://www.codechef.com/problems/FGFS/
https://www.hackerrank.com/challenges/board-cutting/problem