Commit Graph

360 Commits

Author SHA1 Message Date
Tianyi Zheng
ae0fc85401
Fix ruff errors (#8936)
* Fix ruff errors

Renamed neural_network/input_data.py to neural_network/input_data.py_tf
because it should be left out of the directory for the following
reasons:

1. Its sole purpose is to be used by neural_network/gan.py_tf, which is
   itself left out of the directory because of issues with TensorFlow.

2. It was taken directly from TensorFlow's codebase and is actually
   already deprecated. If/when neural_network/gan.py_tf is eventually
   re-added back to the directory, its implementation should be changed
   to not use neural_network/input_data.py anyway.

* updating DIRECTORY.md

* Change input_data.py_tf file extension

Change input_data.py_tf file extension because algorithms-keeper bot is being picky about it

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-09 13:25:30 +05:30
AmirSoroush
ce218c57f1
fixes #8673; Add operator's associativity check for stacks/infix_to_p… (#8674)
* fixes #8673; Add operator's associativity check for stacks/infix_to_postfix_conversion.py

* fix ruff N806 in stacks/infix_to_postfix_conversion.py

* Update data_structures/stacks/infix_to_postfix_conversion.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update data_structures/stacks/infix_to_postfix_conversion.py

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-08-01 11:23:34 -07:00
roger-sato
0b0214c42f
Handle empty input case in Segment Tree build process (#8718) 2023-07-31 11:46:30 -07:00
AmirSoroush
384c407a26
Enhance the implementation of Queue using list (#8608)
* enhance the implementation of queue using list

* enhance readability of queue_on_list.py

* rename 'queue_on_list' to 'queue_by_list' to match the class name
2023-07-30 19:07:35 -07:00
AmirSoroush
d4f2873e39
add reverse_inorder traversal to binary_tree_traversals.py (#8726)
* add reverse_inorder traversal to binary_tree_traversals.py

* Apply suggestions from code review

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2023-07-30 17:54:15 -07:00
Sangmin Jeon
a03b739d23
Fix radix_tree.py insertion fail in ["*X", "*XX"] cases (#8870)
* Fix insertion fail in ["*X", "*XX"] cases

Consider a word, and a copy of that word, but with the last letter repeating twice. (e.g., ["ABC", "ABCC"])
When adding the second word's last letter, it only compares the previous word's prefix—the last letter of the word already in the Radix Tree: 'C'—and the letter to be added—the last letter of the word we're currently adding: 'C'. So it wrongly passes the "Case 1" check, marks the current node as a leaf node when it already was, then returns when there's still one more letter to add.
The issue arises because `prefix` includes the letter of the node itself. (e.g., `nodes: {'C' : RadixNode()}, is_leaf: True, prefix: 'C'`) It can be easily fixed by simply adding the `is_leaf` check, asking if there are more letters to be added.

- Test Case: `"A AA AAA AAAA"`
  - Fixed correct output:
  ```
  Words: ['A', 'AA', 'AAA', 'AAAA']
  Tree:
  - A   (leaf)
  -- A   (leaf)
  --- A   (leaf)
  ---- A   (leaf)
  ```
  - Current incorrect output:
  ```
  Words: ['A', 'AA', 'AAA', 'AAAA']
  Tree:
  - A   (leaf)
  -- AA   (leaf)
  --- A   (leaf)
  ```

*N.B.* This passed test cases for [Croatian Open Competition in Informatics 2012/2013 Contest #3 Task 5 HERKABE](https://hsin.hr/coci/archive/2012_2013/)

* Add a doctest for previous fix

* improve doctest readability
2023-07-24 11:29:05 +02:00
Caeden Perelli-Harris
93fb169627
[Upgrade Ruff] Fix all errors raised from ruff (#8879)
* chore: Fix tests

* chore: Fix failing ruff

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore: Fix ruff errors

* chore: Fix ruff errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cellular_automata/game_of_life.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* chore: Update ruff version in pre-commit

* chore: Fix ruff errors

* Update edmonds_karp_multiple_source_and_sink.py

* Update factorial.py

* Update primelib.py

* Update min_cost_string_conversion.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>
2023-07-22 12:05:10 +02:00
pre-commit-ci[bot]
c9ee6ed188
[pre-commit.ci] pre-commit autoupdate (#8853)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.275 → v0.0.276](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.275...v0.0.276)

* Update double_ended_queue.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update double_ended_queue.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>
2023-07-04 00:20:35 +02:00
Himanshu Tomar
331585f3f8
Algorithm: Calculating Product Sum from a Special Array with Nested Structures (#8761)
* Added minimum waiting time problem solution using greedy algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ruff --fix

* Add type hints

* Added two more doc test

* Removed unnecessary comments

* updated type hints

* Updated the code as per the code review

* Added recursive algo to calculate product sum from an array

* Added recursive algo to calculate product sum from an array

* Update doc string

* Added doctest for product_sum function

* Updated the code and added more doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added more test coverage for product_sum method

* Update product_sum.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>
2023-06-23 10:26:05 +02:00
Linus M. Henkel
5b0890bd83
Dijkstra algorithm with binary grid (#8802)
* Create TestShiva

* Delete TestShiva

* Implementation of the Dijkstra-Algorithm in a binary grid

* Update double_ended_queue.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update least_common_multiple.py

* Update sol1.py

* Update pyproject.toml

* Update pyproject.toml

* https://github.com/astral-sh/ruff-pre-commit v0.0.274

---------

Co-authored-by: ShivaDahal99 <130563462+ShivaDahal99@users.noreply.github.com>
Co-authored-by: jlhuhn <134317018+jlhuhn@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-22 13:49:09 +02:00
Frank-1998
b0f871032e
Fix removing the root node in binary_search_tree.py removes the whole tree (#8752)
* fix issue #8715

* [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>
2023-06-18 18:30:06 +02:00
Sundaram Kumar Jha
4a27b54430
Update permutations.py (#8102) 2023-05-31 12:56:59 +12:00
Christian Clauss
4b79d771cd
Add more ruff rules (#8767)
* Add more ruff rules

* Add more ruff rules

* pre-commit: Update ruff v0.0.269 -> v0.0.270

* Apply suggestions from code review

* Fix doctest

* Fix doctest (ignore whitespace)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-26 09:34:17 +02:00
Christian Clauss
4c1f876567
Solving the Top k most frequent words problem using a max-heap (#8685)
* Solving the `Top k most frequent words` problem using a max-heap

* Mentioning Python standard library solution in `Top k most frequent words` docstring

* ruff --fix .

* updating DIRECTORY.md

---------

Co-authored-by: Amos Paribocci <aparibocci@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-27 23:02:07 +05:30
isidroas
14bdd174bb
Bloom Filter (#8615)
* Bloom filter with tests

* has functions constant

* fix type

* isort

* passing ruff

* type hints

* type hints

* from fail to erro

* captital leter

* type hints requested by boot

* descriptive name for m

* more descriptibe arguments II

* moved movies_test to doctest

* commented doctest

* removed test_probability

* estimated error

* added types

* again hash_

* Update data_structures/hashing/bloom_filter.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* from b to bloom

* Update data_structures/hashing/bloom_filter.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/hashing/bloom_filter.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

* syntax error in dict comprehension

* from goodfather to godfather

* removed Interestellar

* forgot the last Godfather

* Revert "removed Interestellar"

This reverts commit 35fa5f5c4b.

* pretty dict

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bloom_filter.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-08 19:39:24 +02:00
Christian Clauss
2f9b03393c
Delete queue_on_two_stacks.py which duplicates queue_by_two_stacks.py (#8624)
* Delete queue_on_two_stacks.py which duplicates queue_by_two_stacks.py

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-08 17:46:19 +05:30
amirsoroush
5cb0a000c4
Queue implementation using two Stacks (#8617)
* Queue implementation using two Stacks

* fix typo in queue/queue_on_two_stacks.py

* add 'iterable' to queue_on_two_stacks initializer

* make queue_on_two_stacks.py generic class

* fix ruff-UP007 in queue_on_two_stacks.py

* enhance readability in queue_on_two_stacks.py

* Create queue_by_two_stacks.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-08 13:41:08 +02:00
amirsoroush
63710883c8
Remove extra len calls in doubly-linked-list's methods (#8600) 2023-04-01 17:53:21 +05:30
amirsoroush
e4d90e2d5b
change space complexity of linked list's __len__ from O(n) to O(1) (#8183) 2023-04-01 08:26:43 +02:00
pre-commit-ci[bot]
3f9150c1b2
[pre-commit.ci] pre-commit autoupdate (#8294)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.255 → v0.0.257](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.255...v0.0.257)

* Fix PLR1711 Useless  statement at end of function

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-20 22:16:13 +01:00
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
c96241b5a5
Replace bandit, flake8, isort, and pyupgrade with ruff (#8178)
* Replace bandit, flake8, isort, and pyupgrade with ruff

* Comment on ruff rules

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-15 13:58:25 +01:00
Andrey
b797e437ae
Add hashmap implementation (#7967) 2023-03-14 01:31:27 +01:00
Christian Clauss
64543faa98
Make some ruff fixes (#8154)
* Make some ruff fixes

* Undo manual fix

* Undo manual fix

* Updates from ruff=0.0.251
2023-03-01 17:23:33 +01:00
Christian Clauss
c909da9b08
pre-commit: Upgrade psf/black for stable style 2023 (#8110)
* 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>
2023-02-01 18:44:54 +05:30
Christian Clauss
08c2245705
Upgrade to flake8 v6 (#8007)
* Upgrade to flake8 v6

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-29 16:56:41 +01:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Dhruv Manilawala
8bfd1c844b
fix: mypy 0.991 issues (#7988)
* fix: mypy 0.991 issues

* fix: invalid condition for base case
2022-11-15 18:29:14 +01:00
Dhruv Manilawala
3bf86b91e7
fix: no implicit optional (#7984) 2022-11-15 14:55:14 +01:00
Alexander Pantyukhin
7b2eca0243
add distribute coins (#7975)
* add distribute coins

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix review notes

* fix typehint

* fix type in TreeNode

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 15:49:38 +13:00
Caeden Perelli-Harris
daa1c7529a
Raise error not string (#7945)
* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* feat: Apply `__repr__` changes

* chore: Fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.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>
2022-11-06 15:54:44 +01:00
Alexander Pantyukhin
7f1a5521f4
add prefix sum (#7959)
* add prefix sum

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-04 20:30:32 +13:00
Alexander Pantyukhin
3e1cb70abf
add algorithm to check binary search tree (#7947)
* add algorithm to check binary search tree

* add tests

* add leetcode link

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typehints

* typehints fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix flake8

* fix typehint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add TreeNode resolving

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* change func name

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* review notes fixes.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix flake8

* fix flake 8

* fix doctest

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-03 21:03:37 +01:00
Christian Clauss
45b3383c39
Flake8: Drop ignore of issue A003 (#7949)
* Flake8: Drop ignore of issue A003

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-02 19:20:45 +01:00
Alex de la Cruz
b2165a65fc
Added Radix Tree in data structures (#6616)
* added radix tree to data structures

* added doctests

* solved flake8

* added type hints

* added description for delete function

* Update data_structures/trie/radix_tree.py

* Update radix_tree.py

* Update radix_tree.py

* Update radix_tree.py

Co-authored-by: Alex de la Cruz <alex@Alexs-MacBook-Air.local>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-31 14:14:33 +01:00
Si Lam
ca923389c0
Description of Double hasing (#6467)
* Description of DOuble hasing

* Fix sheebang

* Update double_hash.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update double_hash.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 11:25:51 +01:00
Andrey
1550731cb7
Remove file-level flake8 suppression (#7844)
* Remove file-level flake8 suppression

* updating DIRECTORY.md

* Fix tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 22:45:21 +02:00
Anshraj Shrivastava
efb4a3aee8
added algo for finding permutations of an array (#7614)
* Add files via upload

* Delete permutations.cpython-310.pyc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.py

* Update permutations.py

* Add files via upload

* Delete permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/arrays/permutations.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/arrays/permutations.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update permutations.py

* Update permutations.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update permutations.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: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-29 15:29:15 +02:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Christian Clauss
19bff003aa
Adopt Python >= 3.8 assignment expressions using auto-walrus (#7737)
* Adopt Python >= 3.8 assignment expressions using auto-walrus

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 15:54:54 +02:00
Caeden Perelli-Harris
25757e697c
Binary tree path sum (#7748)
* feat: Implement binary tree path sum (#7135)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/binary_tree_path_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Rename `dfs` to `depth_first_search`

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-27 23:03:01 +02:00
Caeden Perelli-Harris
61eedc16c3
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Shubham Kondekar
3448ae5cec
[Binary Tree] Different views of binary tree added (#6965)
* Different views of binary tree added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* mypy errors resolved

* doc test for remaining functions

* Flake8 comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Example moved in if block

* doctest cases added

* Cases from if block removed

* Update data_structures/binary_tree/diff_views_of_binary_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/binary_tree/diff_views_of_binary_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* PR Comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* flake8 warning resolved

* Changes revered

* flake8 issue resolved

* Put the diagrams just above the doctests

* Update diff_views_of_binary_tree.py

* Update diff_views_of_binary_tree.py

* I love mypy

* [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>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-17 22:30:01 +02:00
CenTdemeern1
04698538d8
Misc fixes across multiple algorithms (#6912)
Source: Snyk code quality
Add scikit-fuzzy to requirements

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 10:55:38 +05:30
Caeden
c94e215c8d
types: Update binary search tree typehints (#7197)
* types: Update binary search tree typehints

* refactor: Don't return `self` in `:meth:insert`

* test: Fix failing doctests

* Apply suggestions from code review

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 00:51:23 +02:00
Caeden
a652905b60
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
2022-10-15 19:29:42 +02:00
Caeden
98a4c24878
feat: Binary tree node sum (#7020) (#7162)
* feat: Binary tree node sum (#7020)

* feat: Sum of all nodes in binary tree explanation (#7020)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/binary_tree_node_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Change replace method with `__iter__` overriding (#7020)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-15 14:58:09 +02:00
Caeden
6e69181d1f
refactor: Replace list() and dict() calls with literals (#7198) 2022-10-15 06:37:03 +05:30
Caeden
2058775005
refactor: Make code more understandable (#7196)
* refactor: Make code more understandable

* [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>
2022-10-15 00:25:15 +02:00