#include<iostream.h>
#include<conio.h>
int main()
{
int a[100], n, i, item, beg, end, mid;
clrscr();
cout<<"Enter the number of elements : ";
cin>>n;
cout<<endl<<"Enter the numbers in ascending order : "<<endl;
for(i=0; i<=n-1; i++)
{
cin>>a[i];
}
cout<<"Enter the no. to be searched : ";
cin>>item;
beg = 0;
end = n-1;
mid = (beg+end)/ 2;
while (beg<=end && item !=a[mid])
{
if (item > a [mid])
beg= mid + 1;
else
end = mid - 1 ;
mid = (beg + end) / 2;
}
if(a[mid]==item)
cout<<endl<<item<<" is found in position "<<mid+1;
else
cout<<endl<<"Item does not exist";
getch();
return 0;
}
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

To search an element of an array using binary search.

 

 

 

 

 

 

 

 

 

      

                                                                                                                                    

1 To read n elements of an array and display them.
2 To input n element of an array and display them in ascending order using bubble sort.
3 To input n element of an array and display them in ascending order using selection sort.
4 To search an element of an array using them search.
5 To search an element of an array using binary search.
6 To initialize the elements of two dimensional array and display the content of the on the screen.
7 To copy the contentents of one string to another.
8 To combine two given strings and display the output obtained.
9 To compare two strings alphabetically.
10 To accept a string and convert all characters in a string from uppercase to lowercase.
11 To accept a string and convert all characters in a string from lowercase to uppercase.
12 To accept a string and average all characters in reverse order.
13 Program to find the smallest element in an array and position its occurrence.
14 To find maximum and minimum element in an array having N element.
15 Program to generate Fibonacci series using arrays.
16 Program to read and display square matrix.
17 Program to input nxn matrices and display their sum as third matrix.
18 Program to input two nxn matrices and display their product.
19 Program to output N*N matrix element, determine if it is a symmetrical matrix.
20 To find length of a string without using strlen () function.
21 To find the frequency of the occurrence of a specified character.
22 To compare two strings without using library functions.
23 Program to copy one string to another without using library function.
24 Program to accept a string and convert all characters in a string from uppercase to lowercase without using library function.
25 To accept a string and convert all characters a string from lowercase to uppercase without using library function.
26 To extract a substring from a given string .
27 To find whether the given string is palindrome a not.
28 To input a strong and string and find the number o numeric characters, lowercase alphabetical characters, uppercase alphabetical characters and any characters other then the above.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement