Community Sites
Create your own community website and start earning today !
It's Free !
Forum
Resources
Mentors
Projects
Entrance Exams
Question Papers
Colleges
Courses
Universities
Schools
Make Money
Communities
Members
Bookmarks
Polls
Fresher Jobs
Funny Photos
B.Tech Projects
New Member FAQ
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
eldho
(40)
mayur tiwary
(30)
narendra
(15)
Last 7 Days
sunil
(2114)
Saagar
(1696)
satish
(1423)
more...
Awards & Gifts
Online Exams
Aptitude Questions
General Aptitude Tests
Medical Entrance
Engineering Entrance
Bank Tests
TOEFL & IELTS Questions
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Program for implementation of SEARCHING TECHNIQUES
Posted Date: 17 Dec 2007 Resource Type:
Articles/Knowledge Sharing
Category:
Education
Posted By:
Jagadeesan. D
Member Level:
Silver
Rating:
Points
: 4
SEARCHING TECHNIQUES
#include
#include
#include
class search{
private:
int a[20];
int i,j,temp,s,n;
public:
void getdata();
void sort();
void b_search();
void l_search();
};
void search::getdata(){
cout<<"\nEnter the Total no. of Elements\t";
cin>>n;
for(i=0;i
cin>>a[i];
}
}
void search::l_search(){
cout<<"\n\n\t\t LINEAR SEARCH\n";
cout<<"\n\nEnter the Element you want to Search\t";
cin>>s;
int flag=0;
for(i=0;i
if(a[i]==s) {
cout<<"\nSuccessful Search located at the position\t"<< i+1<<"\n";
flag=1;
}
}
if(flag==0)
cout<<"\n Unsuccessful Search";
}
void search::sort(){
for(i=0;i
for(j=0;j
if(a[i]
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
cout<<"\n\n\t\t SORTING\n";
cout<<"\n\nThe Sorted Elements are\t";
for(i=0;i
cout<<"\t"<
}
}
void search::b_search(){
int low,high,middle;
low=0;
high=n;
cout<<"\n\n\t\t BINARY SEARCH\n";
cout<<"\n\nEnter the Element you want to Search\t";
cin>>s;
while(low<=high) {
middle=(low+high)/2;
if(s
high=middle-1;
else
if(s>a[middle])
low=middle+1;
else {
cout<<"\nSuccessfull Search located at the position \t"<< middle+1<<"\n";
return;
}
}
cout<<"\nUnsuccessful Search";
}
void main()
{
int choice;
search sh;
clrscr();
do {
cout<<"\n\t1.Linear Search";
cout<<"\n\t2.Bineary Search";
cout<<"\n\t3.Exit\n";
cout<<"\n\nInput the Choice\t";
cin>>choice;
switch(choice) {
case 1:
sh.getdata();
sh.l_search();
break;
case 2:
sh.getdata();
sh.sort();
sh.b_search();
break;
case 3:
return;
} }
while(choice<=2);
getch();
}
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Program for implementation of SORTING TECHNIQUES
Previous Resource:
MCS601 - COMPUTER ARCHITECTURE
Return to Discussion Resource Index
Post New Resource
Category:
Education
Post resources and
earn money
!
Related Resources
ANNUNIVERSITY,BE CIVIL ENGINEERING,VII SEMESTER ELECTIVES,CE1014 -GROUND IMPROVEMENT TECHNIQUES
Program to sort list of elements using bubble sort.
importance of education
T.M. Bhagalpur Univ.'s Syllabus of B. Sc. (Hons) Computer Application Part 1(Paper I)
Boost Your Education And Life With An Online Degre
Watch TV Channels
Watch Asianet online
Kairali TV in Internet
Surya TV online
Amritha TV Channel
Contact Us
Editors
Privacy Policy
Terms Of Use
SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.