* infix to prefix missing feature added
* infix to prefix missing feature added
* infix to prefix missing feature added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* infix to prefix missing feature added (comments)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* infix to prefix missing feature added (comments)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* newly updated infix_to_prefix
* newly updated infix_to_prefix_2
* newly updated infix_to_prefix_3
* from the beginning
* Created flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py (space added)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py space added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* flatten binary tree to linked list - 1
* flatten binary tree to linked list final
* flatten binary tree to linked list final
* review updated
* Update flatten_binarytree_to_linkedlist.py
* Update .pre-commit-config.yaml
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
---------
Co-authored-by: ArunSiva <Arunsiva003@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Made binary tree memory-friendly using generators based travels. Fixes
#8725
* Made binary tree memory-friendly using generators based travels. Fixes
#8725
* Fixed pre-commit errors
* rsa key doctest
* move doctest to module docstring
* all tests to doctest
* moved is_right to property
* is right test
* fixed rsa doctest import
* Test error when deleting non-existing element
* fixing ruff EM102
* convert property 'is_right' to one-liner
Also use 'is' instead of '=='
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* child instead of children
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* remove type hint
* Update data_structures/binary_tree/binary_search_tree.py
---------
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* Binary Search Tree Inorder Traversal
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Binary Search Tree Inorder Traversal v2
* Binary Search Tree Inorder Traversal
* Binary Search Tree Inorder Traversal
* Update inorder_tree_traversal_2022.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update inorder_tree_traversal_2022.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update inorder_tree_traversal_2022.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update data_structures/binary_tree/inorder_tree_traversal_2022.py
* Update data_structures/binary_tree/inorder_tree_traversal_2022.py
* Updated
* Updated
* Update inorder_tree_traversal_2022.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update inorder_tree_traversal_2022.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update data_structures/binary_tree/inorder_tree_traversal_2022.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Updated and removed print statement
removed the print from inorder function
* [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>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Enhance fenwick_tree.py
* Change update to add in fenwick_tree.py
* Some changes
* Fix bug
* Add O(N) initializer to FenwickTree
* Add get method to Fenwick Tree
* Change tree in Fenwick Tree
* Add rank query to FenwickTree
* Add get_array method to FenwickTree
* Add some tests
* Update data_structures/binary_tree/fenwick_tree.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/binary_tree/fenwick_tree.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/binary_tree/fenwick_tree.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* change `List` to `list`
Co-authored-by: Christian Clauss <cclauss@me.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>
* [mypy] Fix type annotations for binary tree traversals in data structures
* Change variable name and update level_order_1 to use a deque
Using a deque instead of a list here, because since we are removing from the beginning of the list, the deque will be more efficient.
* remove duplicate function
* Update data_structures/binary_tree/binary_tree_traversals.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* fix function name at line 137
* Update data_structures/binary_tree/binary_tree_traversals.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update data_structures/binary_tree/binary_tree_traversals.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Remove type alias and use the new syntax
* Update data_structures/binary_tree/binary_tree_traversals.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Remove prints inside functions and return lists
Co-authored-by: John Law <johnlaw.po@gmail.com>
* 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>
* Added the matrix_exponentiation.py file in maths directory
* Implemented the requested changes
* Update matrix_exponentiation.py
* resolve merge conflict with upstream branch
* add new line at end of file
* add wavelet_tree
* fix isort issue
* updating DIRECTORY.md
* fix variable names in wavelet_tree and correct typo
* Add type hints and variable renaming
* Update data_structures/binary_tree/wavelet_tree.py
Add doctests to placate the algorithm-bot, thanks to @cclauss.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Move doctest to individual functions and reformat code
* Move common test array to the global scope and reuse in tests
* MMove test array to global scope and minor linting changes
* Correct the failing pytest tests
* MUse built-in list for type annotation
* Update wavelet_tree.py
* types-requests
* updating DIRECTORY.md
* Update wavelet_tree.py
* # type: ignore
* # type: ignore
* Update decrypt_caesar_with_chi_squared.py
* ,
* Update decrypt_caesar_with_chi_squared.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Aniruddha Bhattacharjee <aniruddha@Aniruddhas-MacBook-Air.local>