Posts

Showing posts with the label ADA ( Analysis and Designs of Algorithms) Practical Lab

ADA ( Analysis and Designs of Algorithms) Practical Lab

Image
1)Binary Search Recursively #include<iostream.h> #include<conio.h> void BS(int a[10],int sk,int lb,int ub) {  int mid;  if(lb>ub)  cout<<"key not found\n";  else    {     mid=(lb+ub)/2;     if(sk==a[mid])     cout<<"element found";     else        {      if(sk>a[mid])      BS(a,sk,mid+1,ub);      else      BS(a,sk,lb,mid-1);      }      }      } void main() { clrscr(); int b,c,d; int e[10]; cout<<"enter the no.in the array in sorted manner"; for(int i=0;i<10;i++)   {   cin>>e[i];   cout<<"\n";   }   cout<<"enter the search key";   cin>>d;   BS(e,d,0,10);   getch();   }  2) Quick Sort Recursively #include<stdio.h> #...