You are on page 1of 2

Algorithm Analysis and Design

Assignment No.1 BS (CS), Spring 2017 Maximum Points: 100

Due Date:11th April , 2017


Instructions

The purpose of this assignment is to give you hands on practice. It is


expected that students will solve the assignments themselves. Following
rules will apply during the evaluation of assignment.
Cheating from any source will result in zero marks in the
assignment.
Any student found cheating in any of the two assignments submitted
will be awarded "F" grade in the course.
No assignment after due date will be accepted

Question No. 1 (50 Points)

Suppose a0, a1, a2, is defined as follows:


a0 = 1,
a1=2,
a2= 3,
ak = a k-1 + a k-2 + a k-3 for all integers k 3.
Then an 2nfor all integers n0. Prove it using mathematical induction

Question No. 2 (50 Points)

The knapsack problem arises whenever there is resource allocation with


no financial constraints problem Statement
You are in Japan on an official visit and want to make shopping from a store (Best Denki)
You have a list of required items
You have also a bag (knapsack), of fixed capacity, and only you can fill this bag with the
selected items
Every item has a value (cost) and weight,
And your objective is to seek most valuable set of items which you can buy not exceeding bag
limit.
Use Brute force to solve the problem.
Input
Given nitems each
weight wi
value vi
Knapsack of capacity W

Output: Find most valuable items that fit into the knapsack
Example:
Item weight value knapsack capacity W =16
1 2 20
2 5 30
3 10 50
4 5 10

You might also like