Binary Search in Python

Binary Search in Python

Here, you will learn and get the code of Binary Search in Python programming.

Binary Search is an algorithm used for searching a particular element in an array. It works on sorted array. It is more efficient than linear search as it reduces the number of comparisons to half.

Program Code of Binary Search in Python

Output:

Enter 5 numbers
Input item : 6
Input item : 1
Input item : 3
Input item : 2
Input item : 6
Enter a number to search location : 3
Element is present at index 2

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top