* 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>
* added hill climbing algorithm
* Shorten long lines, streamline get_neighbors()
* Update hill_climbing.py
* Update and rename optimization/hill_climbing.py to searches/hill_climbing.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* create simnple binary search
#A binary search implementation to test if a number is in a list of elements
* Add .py, format with psf/black, and add doctests
* fix endless loop bug, divide 0 bug and update description
fix an endless bug, for example, if collection = [10,30,40,45,50,66,77,93], item = 67.
fix divide 0 bug, when right=left it is not OK to point = left + ((item - sorted_collection[left]) * (right - left)) // (sorted_collection[right] - sorted_collection[left])
update 'sorted' to 'ascending sorted' in description to avoid confusion
* delete swap files
* delete 'address' and add input validation