* Add solution and test files for project euler 54
* Update sol1.py
* updating DIRECTORY.md
* Fix: use proper path to open files
* Commit suggestions:
- Use list comprehension instead of map
- Sort imports using isort
* Changes made as suggested (simplified a lot):
- List and set comprehension instead of itemgetter
- Using enumerate as it's easy to read
- Divided into list of card values and set of card suit as set will
remove all the duplicate values. So, no need for double indexing.
- Add test for testing multiple calls to five_high_straight function
* Add suggestions and simplified:
- Split generate_random_hands function into two:
- First will generate a random hand
- Second, which will be called, will return a generator object
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Update and rename bin_to_octal.py to binary_to_octal.py
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* added an algorithm which checks a linked list for loops and returns true if one is found
* added doctests and clarified meaning of loop
* Define Node.__iter__()
* Update and rename has_loop.py to has_duplicate_data.py
* Update has_duplicate_data.py
* Update has_duplicate_data.py
* Update and rename has_duplicate_data.py to has_loop.py
* Update has_loop.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* * rename variable
* fix type hint
* fix doctest
* added test function
* fixed import error
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.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>
* Updated problem_04 in project_euler
* fixup! Format Python code with psf/black push
* That number is larger than our acceptable range.
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix spelling in docstrings
* Improve comments and formatting
* Update print statement to reflect doctest change
* improve phrasing and apply black
* Update rat_in_maze.py
This method is recursive starting from (i, j) and going in one of four directions:
up, down, left, right.
If a path is found to destination it returns True otherwise it returns False.
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>
* fix assignment of a variable to itself
* Fix unnecessary 'else' clause in loop
* formatting and redundant reasignment fix
* mark unreachable code with a TODO comment
* fix variable defined multiple times
* fix static method without static decorator
* revert unintended autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* revert autoformatting issue
* applied black autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix Non Recursive Depth First Search
* Unindent docstring
* Reindent docstring by 1 space
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update scoring_functions.py
We can find accuracy by manually if we are not going to use sklearn library.
* Update scoring_functions.py
* Update machine_learning/scoring_functions.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create alternate_disjoint_set.py
This code implements a disjoint set using Lists
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression
* Update alternate_disjoint_set.py
Added typehints, doctests and some suggested variable name change
* Update alternate_disjoint_set.py
* Formatted with Black
* More formatting
* Formatting on line 28
* Error in Doctest
* Doctest Update in alternate disjoint set
* Fixed build error
* Fixed doctest
* Delete sleep_sort.py
A silly algorithm designed to waste time. #2350 demonstrates that it is a 20+ second denial of service attack on every Travis CI run that we do.
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>