Skip to content

This Python script demonstrates the versatile application of binary search in various scenarios

License

Notifications You must be signed in to change notification settings

FrancescoPaoloL/BinarySearchDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Binary Search Demo

This Python script demonstrates the versatile application of binary search in various scenarios:

1. Finding the Square Root

  • The script includes a function (mySqrt) that utilizes binary search to find the square root of a given number.

2. Finding First and Last Occurrence in a Sorted Array

  • Another function (find_first_last_occurrence) employs binary search to find the first and last occurrence of a target element in a sorted array.

3. Searching in a 2D Matrix

  • A function (search_in_2d_matrix) applies binary search to determine whether a target value is present in a 2D matrix where each row and each column is sorted.

4. Finding the Peak Element in an Array

  • The script finds the peak element in an array using binary search.

Python

Languages and Tools

python

Requirements

Just Python 3.6.9

Test Coverage

TODO

License

This project is licensed under the MIT License - see the LICENSE.md file for details


Connect with me

francescopaololezza francescopaololezza

About

This Python script demonstrates the versatile application of binary search in various scenarios

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages