Anda di halaman 1dari 3

M.

Tech/Algorithm Development Lab/2015-2016

Algorithm Development Lab


Course code: IT1051

Lab Assignments ( Part-I )


August 4, 2016

1. a. Implement insertion sort


b. How to sort a nearly sorted array by any efficient approach? justify it
with Python implementation.

2. a. Searching an element, given by user over a sorted list of elements in


increasing order by naive approach.
b. Searching an element, given by user over a sorted list of elements in
increasing order by Divide And Conquer (DAC) approach.

3. a. Calculate the value of an where n N by naive approach for the value


of a, given by user.
b. Calculate the value of an where n N by Divide And Conquer (DAC)
approach for the value of a, given by user.

4. a. Calculate the nth Fibonacci number by naive approach.


b. Calculate the nth Fibonacci number by recursive squaring approach.

5. a. Find the value of multiplication of two n digits numbers by naive ap-


proach where the value of n is given by user.
b. Find the value of multiplication of two n digits numbers by Karatsuba
multiplication approach where the value of n is given by user.

6. a. Find the inversion of an array by naive approach where the array is


given by user.
b. Find the inversion of an array by Divide And Conquer (DAC) ap-
proach where the array is given by user.

7. a. Find the k th smallest element of an array by naive approach where the


array is given by user.
b. Find the k th smallest element of an array by Divide And Conquer
(DAC) approach where the array is given by user.

8. a. Find the maximum sub-array sum by Naive approach where the array
is given by user.
b. Find the maximum sub-array sum by Divide And Conquer (DAC) ap-
proach where the array is given by user.

1
c. Find the maximum sub-array sum by an approach in upper bound of
input size n where the array is given by user.

9. Find closest pair points by Divide And Conquer (DAC) approach.

************

Algorithm Development Lab


Course code: IT1051

Lab Assignments ( Part-II )


August 4, 2016

1. Find the minimum number of scalar multiplication to solve a chain of


matrices, given with dimension by Dynamic Programming method.

2. Find the maximum number of completed jobs over a set of jobs are given
with start and f inish time by Dynamic Programming and Greedy method.

3. A knapsack with capacity(m) and n number of jobs with individual


weight(wi ) and profit(pi ) are given. Find the jobs selection values in row-
vector of size n to maximize the profit, earned from selected jobs, subject
to constraints that cumulative weights of selected jobs must not exceeds
the Knapsacks capacity and selection of job ji is xi such that 0 xi 1.
(Hints: apply Greedy method.)

4. You are given a rod of length n, also prices of length 1 to (n 1) are given
(For example: rod of length 1 cost is Rs. 2/-, rod of length 2 cost is Rs.
7/- and so on). Use Dynamic Programming to calculate optimal cutting
of rod such that prof it is maximized.

5. Given two sequences, find the length of Longest Common Sub-sequence


(LCS) presents in both of them by Dynamic Programming technique,
subject to constraint that a sub-sequence is a sequence that appears in

2
the same relative order, but not necessarily contiguous.
For example: LCS for input Sequences ABCDGH and AEDFHR is
ADH of length 3. LCS for input Sequences AGGTAB and GXTX-
AYB is GTAB of length 4.

6. Coin Changing problem is described as given a value N , if we want to


make change for N cents, and we have infinite supply of each of S =
{S1 , S2 , . . . , Sm } valued coins, how many ways can we make the change?
The order of coins doesnt matter. Identify all possible ways of changing
N cent by Greedy Method.
For example, for N = 4 and S = {1, 2, 3}, there are four solutions:
{1, 1, 1, 1}, {1, 1, 2}, {2, 2}, {1, 3}. So output should be 4. For N = 10 and
S = {2, 5, 3, 6}, there are five solutions: {2, 2, 2, 2, 2}, {2, 2, 3, 3}, {2, 2, 6},
{2, 3, 5}and{5, 5}. So the output should be 5.

************

Algorithm Development Lab


Course code: IT1051

Lab Assignments ( Part-III )


August 4, 2016

1. Implement the approximation algorithm for finding minimum vertex cover


in a given graph.

2. Implement the approximate Traveling Sales Problem(TSP) for finding


minimum cost tour in a given graph.

3. Implement the Greedy approximation algorithm for finding minimum set


cover for covering n number of points in a plane. Value of n is given by
user.

************

Anda mungkin juga menyukai