adalab1

39
Algorithms Laboratory Manual[Sub Code:07MCA48] Department Of MCA Malnad College of Engineering

Upload: achutha795830

Post on 24-Nov-2015

12 views

Category:

Documents


0 download

TRANSCRIPT

Algorithms Laboratory

Algorithms LaboratoryManual[Sub Code:07MCA48]

Department Of MCA

Malnad College of Engineering

1. Implement Recursive Binary search and linear search and determine the time required to search an element. Repeat the experiment for different values of n, the number of elements in the list to be searched and plot a graph of the time taken versus n.

#include#include#include#define MAX 10 int linsearch(int a[],int n,int key) { if(nhigh) return -1; mid=(low+high)/2; if(key==a[mid]) return mid; if(key