https://github.com/francescopaolol/binarysearchdemo
This Python script demonstrates the versatile application of binary search in various scenarios
https://github.com/francescopaolol/binarysearchdemo
2d-matrix peak python sorted-arrays squareroot
Last synced: about 2 months ago
JSON representation
This Python script demonstrates the versatile application of binary search in various scenarios
- Host: GitHub
- URL: https://github.com/francescopaolol/binarysearchdemo
- Owner: FrancescoPaoloL
- License: mit
- Created: 2023-11-24T20:50:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-26T04:00:16.000Z (over 1 year ago)
- Last Synced: 2025-02-14T17:59:45.331Z (4 months ago)
- Topics: 2d-matrix, peak, python, sorted-arrays, squareroot
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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.
## Languages and Tools
## Requirements
```
Just Python 3.6.9
```## Test Coverage
TODO## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Connect with me