Important alert: (current site time 10/25/2014 12:22:15 PM EDT)
 

article

BINARY SEARCH

Email
Submitted on: 3/26/2012 8:43:02 AM
By: Nikzzz 
Level: Beginner
User Rating: Unrated
Compatibility: C, C++ (general)
Views: 3735
 
     THIS PROGRAM TELLS THE POSITION OF AN ELEMENT ENTERED BY THE USER IN AN ARRAY USING BINARY SEARCH (RECURSIVELY).

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				/*
 Name: NIKHIL GUPTA 
 Description: BINARY SEARCH RECURSIVE
*/
#include
#include
int binarysrec(int [],int,int,int);
int main()
{
int n,i,a[100],item,index;
cout<<"Enter the size of array (max.100) : ";
cin>>n;
cout<<"\nEnter the array elements in ascending order...\n";
for( i=0; i>a[i];
cout<<"\nEnter the element to be searched : ";
cin>>item;
index=binarysrec(a,0,n-1,item);
if(index== -1)
cout<<"\nElement not found...!!! ";
else 
cout<<"\nElement found at position : "<
				


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/28/2012 4:59:28 PMLefteris Eleftheriades

where is the rest?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.