Skip to content
This repository was archived by the owner on Nov 26, 2019. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Binary Search

This program takes an array of size N and a number and searches its presence in the array.

Input Format

  • In the first line, there will be a single integer N, describing the no of elements that you want to have in the array.
  • From second line, there will be space for entering the values of the array.
  • Next you need to enter the element you want to search for in the array.

Output Format

Firstly, the array you have created is displayed. Next, the arranged values in ascending order is displayed. Finally, the search result is displayed, i.e, whether the search was successful or not.

Sample Input

Enter no of items in the list: 5
Enter the value: 3
Enter the value: 6
Enter the value: 2
Enter the value: 9
Enter the value: 1
Enter the value to search: 4

Sample Output

The list you entered is:  [3, 6, 2, 9, 1]
The sorted list is:  [1, 2, 3, 6, 9]
Search unsuccessful.

Implemented in: