* Implemented Exponential Search with binary search for improved performance on large sorted arrays.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added type hints and doctests for binary_search and exponential_search functions. Improved code documentation and ensured testability.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update and rename Exponential_Search.py to exponential_search.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Enable ruff PLR5501 rule
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* add exponential_search algorithm
* replace binary_search with binary_search_recursion
* convert left type to int to be useable in binary_search_recursion
* add docs and tests for exponential_search algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* move exponential_search to binary_search.py to pass github auto build tests
delete exponential_search.py file
* Update searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* remove additional space searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* return single data type in exponential_search searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* add doctest mod searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* use // instread of int() convert searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* change test according to new code searches/binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* fix binary_search_recursion multiple type return error
* add a timeit benchmark for exponential_search
* sort input of binary search to be equal in performance test with exponential_search
* raise value error instead of sorting input in binary and exonential search to fix bugs
* Update binary_search.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: user <user@kali.user>
* Added Median of Medians Algorithm
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update median_of_medians.py as per requested changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* pre-commit: Upgrade psf/black for stable style 2023
Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310
> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…
Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.
I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* MAINT: Used f-string method
Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.
* Updated files with f-string method
* Update rsa_key_generator.py
* Update rsa_key_generator.py
* Update elgamal_key_generator.py
* Update lru_cache.py
I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.
* Update lru_cache.py
* Update lru_cache.py
Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* The black formatter is no longer beta
* pre-commit autoupdate
* pre-commit autoupdate
* Remove project_euler/problem_145 which is killing our CI tests
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Chore: Added type hints to searches/binary_search.py
* Use -1 as the sentinal value
* Wrap long lines
* Update binary_search.py
* Update binary_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add type hints, documentation and tests.
* Update searches/ternary_search.py
Sort collection and remove the assertion logic.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Remove assert sorted logic.
* Add assertion list is ordered.
* updating DIRECTORY.md
* updating DIRECTORY.md
* Format with black.
* Change names of variables to descriptive names
* Remove print in doctests
* Fix variables to snake_case notation.
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Fix: Multiple errors in fibonacci search.
- Test lists were not ordered, this is required for Fibonacci search
- Place documentation of function inside function
- Create multiple different tests including, float, char and negatives
- Add type hints in line with #2128
* Fix: sort of modules and delete typehint.
* Apply suggestions from code review
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Correct invocation of lru_cache.
* Add check for input in fibonacci and doctest.
* Correct typehints to comply to numpy style.
* Correct ValueError to TypeError.
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Correct doctest for TypeError.
* Rename single letter names as mentioned in CONTRIBUTING.md.
* Fix: Bug in big lists.
* Remove print(.) in doctests.
* Refactor iterator to while loop.
* Update searches/fibonacci_search.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Corrected name and include static types
- The name of the file is now compliant with python naming conventions
- Add static type as stated in contributing guidelines
* Apply suggestions from code review
- Delete documentation line to run doctests
- Delete type hints for variables that comes from functions
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add edge cases tests.
* print(f"{target} was {not_str}found in {sequence}")
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update linear_search.py
Python implementation of recursive linear search algorithm
* Update linear_search.py
Added different doctests
Added the parameter hints
Handled the exception
* Update linear_search.py
added parameter hints to linear_search
* Update linear_search.py
Both the functions return the index if the target is found and -1 if it is not found
The rec_linear_search raises an exception if there is an indexing problem
Made changes in the doc comments
* Update linear_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Tighten up psf/black and flake8
* Fix some tests
* Fix some E741
* Fix some E741
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* spelling corrections
* review
* improved documentation, removed redundant variables, added testing
* added type hint
* camel case to snake case
* spelling fix
* review
* python --> Python # it is a brand name, not a snake
* explicit cast to int
* spaces in int list
* "!= None" to "is not None"
* Update comb_sort.py
* various spelling corrections in documentation & several variables naming conventions fix
* + char in file name
* import dependency - bug fix
Co-authored-by: John Law <johnlaw.po@gmail.com>