TheAlgorithms / Python Public
master
Commits on Oct 25, 2021
-
add an algorithm to spin some words (#5597)
* add an algorithm to spin some words * Update index.py * Adding type hint of spin_words function * Update and rename python_codewars_disemvowel/index.py to strings/reverse_long_words.py Co-authored-by: Christian Clauss <cclauss@me.com>
-
Improve Project Euler problem 058 solution 1 (#4782)
* Fix typo * Improve solution * Retest * Replace n with number
-
-
Add random graph generator (#5240)
* added complete graph generator function * added doctest, type hints, wikipedia explanation * added return type hint for function complete_graph * added descriptive name for the parameter: n * random graph generator with doctest and type hints * validated using pre-commit * Delete complete_graph_generator.py * fixed doctest * updated following reviews * simplified the code following reviews * fixed doctest and solved consistency issues * consistency fixes
-
Commits on Oct 24, 2021
-
* Add Bifid cipher * Add missing type hint * Fix variable names
-
Commits on Oct 23, 2021
-
-
* Add IIR Filter and Butterworth design functions Signed-off-by: Martmists <martmists@gmail.com> * naming conventions and missing type hints Signed-off-by: Martmists <martmists@gmail.com> * Link wikipedia in IIRFilter Signed-off-by: Martmists <martmists@gmail.com> * Add doctests and None return types Signed-off-by: Martmists <martmists@gmail.com> * More doctests Signed-off-by: Martmists <martmists@gmail.com> * Requested changes Signed-off-by: Martmists <martmists@gmail.com> * run pre-commit Signed-off-by: Martmists <martmists@gmail.com> * Make mypy stop complaining about ints vs floats Signed-off-by: Martmists <martmists@gmail.com> * Use slower listcomp to make it more readable Signed-off-by: Martmists <martmists@gmail.com> * Make doctests happy Signed-off-by: Martmists <martmists@gmail.com> * Remove scipy Signed-off-by: Martmists <martmists@gmail.com> * Test coefficients from bw filters Signed-off-by: Martmists <martmists@gmail.com> * Protocol test Co-authored-by: Christian Clauss <cclauss@me.com> * Make requested change Signed-off-by: Martmists <martmists@gmail.com> * Types Signed-off-by: Martmists <martmists@gmail.com> * Apply suggestions from code review * Apply suggestions from code review * Update butterworth_filter.py Co-authored-by: Christian Clauss <cclauss@me.com>
-
mandelbrot.py: Commenting out long running tests (#5558)
* mandelbrot.py: Commenting out long running tests * updating DIRECTORY.md * Comment out 9 sec doctests * Update bidirectional_breadth_first_search.py * Comment out slow tests * Comment out slow (9.15 sec) pytests... * # Comment out slow (4.20s call) doctests * Comment out slow (3.45s) doctests * Update miller_rabin.py * Update miller_rabin.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> -
Implementation of SHA-256 using Python (#5532)
* Add files via upload * Update sha256.py * Update sha256.py * Update sha256.py * Update sha256.py * Update sha256.py * Update sha256.py * Update sha256.py * Update sha256.py * @staticmethod def preprocessing(data: bytes) -> bytes: Co-authored-by: Christian Clauss <cclauss@me.com>
-
* Updated Pop function Added underflow condition * Update Pop Function Added condition to check underflow of stack * Update stack.py * if not self.stack: raise StackUnderflowError * Add doctests * StackUnderflowError * ..., not .... * Update stack.py Co-authored-by: Christian Clauss <cclauss@me.com>
-
-
Added feature to
web_programming/nasa_data.py: Can download the AP……OD image to a specified location on disk. (#5551) * Added a feature to download images. * Minor changes * Update nasa_data.py * : Co-authored-by: Christian Clauss <cclauss@me.com>
-
Added new file: nasa_data.py (#5543)
* Added new file: nasa_data.py * Modified as per review * Minor change * print(get_archive_data("apollo 2011")["collection"]["items"][0]["data"][0]["description"]) * Update nasa_data.py Co-authored-by: Christian Clauss <cclauss@me.com> -
* add check_cycle.py * Update graphs/check_cycle.py Co-authored-by: John Law <johnlaw.po@gmail.com> * Update check_cycle.py * Apply suggestions from code review Co-authored-by: John Law <johnlaw.po@gmail.com> Co-authored-by: Christian Clauss <cclauss@me.com>
-
[mypy] Add type annotations for linked queue in data structures (#5533)
* [mypy] Add/fix type annotations for linked queue in data_structures * add return type annotation to __iter__ * Add more readable syntax
Commits on Oct 22, 2021
-
[mypy] Fix type annotations for trie.py (#5022)
* Fix type annotations for trie.py * Add strict type annotations to trie.py Annotate return type for all functions and type for "nodes" * updating DIRECTORY.md * Format trie.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> -
Add doctests to prime_check function (#5503)
* added doctests to prime_check function * fix doctests function name
-
Remove wrongly placed double qoutes (#5530)
* Update baconian_cipher.py * Update join.py * Updated type hint
-
Fixed grammar on Anagram Description (#5512)
Made the description more formal, also fixed a few grammatical issues.
-
[mypy] Fix type annotations in
data_structures/binary_tree(#5518)* fix: fix mypy errors Update binary_search_tree `arr` argument to be typed as a list within `find_kth_smallest` function Update return type of `merge_two_binary_trees` as both inputs can be None which means that a None type value can be returned from this function * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> -
split into usable functions and added docstrings for base32 cipher (#…
…5466) * split into usable functions and added docstrings * Simplified code Co-authored-by: Christian Clauss <cclauss@me.com> * Simplified code Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: Christian Clauss <cclauss@me.com>
-
[mypy] fix type annotations for graphs/a_star.py #4052 (#5224)
* [mypy] fix type annotations for graphs/a_star.py #4052 * updating DIRECTORY.md * Add from __future__ import anotations * rename delta by DIRECTIONS Co-authored-by: John Law <johnlaw.po@gmail.com> * Rename delta by DIRECTIONS in all code * Enclose script in __main__ code block * Refactor DIRECTIONS with comments for readibility * Delete heuristic example comment * Do not print, return all values * Fix multilines * fix black * Update a_star.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: John Law <johnlaw.po@gmail.com>
-
-
[mypy] Fix type annotations for boolean_algebra/quine_mc_cluskey.py (#…
…5489) * Add missing type annotation * Fix conversion bug This failed when called with the documented example of `1.5` and was correctly pointed out by `mypy --strict`
-
-
-
[mypy] fix: fix mypy error in singly_linked_list.py (#5517)
The list comprehension shortcut was implicitly expecting a return value causing a mypy error since `insert_tail` doesn't return a value
Commits on Oct 21, 2021
-
[mypy] check polygon and corrections (#5419)
* Update annotations to Python 3.10 #4052 * Add floats doctest * Copy list to avoid changing input unpredictably * Refactor code to make it readable * updating DIRECTORY.md * Improve raised ValueErrors and add doctest * Split doctest in multiples lines * Change ValueError to Monogons and Digons are not poly * Correct doctest refering number of sides Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
-
* updating DIRECTORY.md * pass integer to `math.factorial` in `project_euler/problem_015` * remove duplicated factorial function * updating DIRECTORY.md * Update maths/factorial_iterative.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update factorial_iterative.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com> -
Replace double_ended_queue.py (#5429)
* Add deque_from_scratch.py * added deque_from_scratch.py * add extend, extendleft and make comparison * updated operations list * fix doctest on Deque.__iter__ * pre-commit fix * time complexity comments, change type hints * pre-commit fix * added more doctests
Commits on Oct 20, 2021
-
Fix typos in Sorts and Bit_manipulation (#4949)
* Fix several typos * Update bit_manipulation/README.md Co-authored-by: John Law <johnlaw.po@gmail.com> * Update double_sort.py Co-authored-by: John Law <johnlaw.po@gmail.com>