https://github.com/shikha-code36/binary_search
A binary search algorithm method
https://github.com/shikha-code36/binary_search
algorithms algorithms-and-data-structures binary-search binary-search-algorithm data-structures data-structures-and-algorithms python-ds-algo search-algorithm searching-algorithms searching-algorithms-interview
Last synced: about 2 months ago
JSON representation
A binary search algorithm method
- Host: GitHub
- URL: https://github.com/shikha-code36/binary_search
- Owner: Shikha-code36
- License: mit
- Created: 2023-02-10T11:30:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T14:45:31.000Z (about 2 years ago)
- Last Synced: 2024-04-25T17:41:47.506Z (about 1 year ago)
- Topics: algorithms, algorithms-and-data-structures, binary-search, binary-search-algorithm, data-structures, data-structures-and-algorithms, python-ds-algo, search-algorithm, searching-algorithms, searching-algorithms-interview
- Language: Python
- Homepage: https://pypi.org/project/search-binary/0.0.1/
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# binarysearch_build
A simple implementation of binary search in Python.
# Binary Search
Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half.
## Installation
- Make sure you have Python installed in your system.
- Run Following command in the CMD.```
pip install search_binary
```
## UsageHere's an example of how to use the `binary_search` function:
```
from search_binary import binary_searcharr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
target = 5
result = binary_search(arr, target)
print(result) # Output: 4
```The `binary_search` function takes in two arguments: `arr` and `target`. The `arr` argument is a list of sorted values, and the `target` argument is the value you're searching for in the list. The function returns the index of the target value in the list, or `-1` if the target value is not found.
## Contributing
Contributions are welcome! If you'd like to contribute, simply fork the repository, make your changes, and submit a pull request.
## License
This package is licensed under the MIT License. See the `LICENSE` file for details.