Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Introduction to Algorithms – Lab Exercise-3

Note: (1) You have to use only divide and conquer method to solve following program.
(2) In final exam how to find time complexity (using recurrence relation, master's theorem
etc ) will be part of algorithm lab.

Lab 3:

1. Write a C or a C++ program to find ith Fibonacci number.


2. Write a C or a C++ program to search an element using Binary search.
3. Suppose you have a list of contiguous numbers, but it is somehow missing out on one
number in the list. For an example, take this: 4,5,6,7,8,9,10,11,12,14,15
The task was to find the missing number which in this case is 13.
4. Write a C or a C++ program to sort the given array using Merge sort.
5. Write a C or a C++ program to find ith smallest number in a given array using Ran-
domized Select Algorithm. (CLRS 186)
6. Write a C or a C++ program to find a subset of a given set S = s1; s2; :::::; sn of n
positive integers whose sum is equal to a given positive integer d. For example, if S = 1; 2;
5; 6; 8 and d = 9 there are two solutions 1; 2; 6 and 1; 8.

Note: Find the time complexity of all above algorithms.

You might also like