FrancescoPaoloL / BinarySearchDemo

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:Python 100.0%