Lab-test

Opened: Tuesday, 17 August 2021, 10:15 AM
Due: Tuesday, 17 August 2021, 11:35 AM

Divide the last two digit of your roll number by 4 and find out the remainder. Then add the remainder with 1. That's your problem number. For example: Suppose your roll number is 151-132-12345 

45%4 = 1.  Then 1+1 = 2. 2 is your problem number.

1. Given weights and values of n items, we need to put these items in a knapsack of capacity W to get the maximum total value in the  knapsack. Implement the greedy approach.

2. Implement quick sort taking input from console.

3. Suppose,  you have a dataset containing numbers: 

1, 3, 6, 10, 20, 45, 67, 14

Which algorithm you will prefer to search 45 in order to obtain a reduced time complexity. Implement it.

4. You are given infinite coins of denominations v1, v2, v3,…..,vn and a sum S. Your task is to find the minimum number of coins required to get the sum S through implementation using greedy approach.