Skip to content

A recursive Binary search implementation in C++

advdamian/cpp-binarysearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Recursive Binary search program in C++.

Binary search implementation in c++.
The program asks for a sorted array and a target element to search for.
If the array is not sorted, the program exits.
If the target element is found, its position is displayed.
If the element is not found on the first try, the user gets a second chance to enter another target.

Example:

Enter the number of elements: 5
Enter a sorted array of elements:
Position 1: 2
Position 2: 4
Position 3: 6
Position 4: 8
Position 5: 10
Enter the target element: 7
Element 7 not found. Please enter another target element. One try remaining.
6
Element 6 found at position: 3

About

A recursive Binary search implementation in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages