+ All Categories

ADALab1

Date post: 24-Nov-2015
Category:
Upload: achutha795830
View: 11 times
Download: 0 times
Share this document with a friend
39
Algorithms Laboratory Manual[Sub Code:07MCA48] Department Of MCA Malnad College of Engineering
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