* equilibrium index in an array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* equilibrium index in an array
* equilibrium index in an array
* equilibrium index in an array removed type in docstring
---------
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>
* symmectric tree
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed trailing spaces
* escape sequence fix
* added return type
* added class
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* wordings fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added static method
* added type
* added static method
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* wordings fix
* testcase added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* testcase added for mirror function
* testcase added for mirror function
* made the requested changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* made the requested changes
* doc test added for symmetric, asymmetric
* Update symmetric_tree.py
---------
Co-authored-by: jeevaramanthan.m <jeevaramanathan.m@infosys.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>
* fix the edge case of the double ended queue pop the last element
* refactoring doc
---------
Co-authored-by: Jiang15 <weijiang@weijiangs-MacBook-Pro.local>
* add median of two sorted array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix syntax
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix syntax
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* improve code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add documentation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [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>
* 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>
* add reverse k group linkedlist
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* Update reverse_k_group.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update reverse_k_group.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update reverse_k_group.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>
* 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
* Rotate linked list by k.
* Rotate linked list by k.
* updated variable name.
* Update data_structures/linked_list/rotate_linked_list_by_k.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
* Update data_structures/linked_list/rotate_linked_list_by_k.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update data_structures/linked_list/rotate_linked_list_by_k.py
* Make Node a dataclass
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* added addAtPosition to simple linked list
* added addAtPosition to simple linked list
* modified the add function to take an optional position command
* fixed type safety errors:
* fixed type safety errors:
* fixed type safety errors:
* fixed type safety errors:
* fixed size error
* fixed size error
* added doctest and updates the else after checking if posiiton argument less than 0 or not
* added doctest and updates the else after checking if posiiton argument less than 0 or not
* fixed the contributing.md mistake
* added doctest for out of bounds position value, both negative and positive
* Updated postfix_evaluation.py to support Unary operators and floating point numbers Fixes#8754 and #8724
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py
Signed-off-by: Arijit De <arijitde2050@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Updated postfix_evaluation.py to support Unary operators and floating point numbers. Fixes#8754 and formatted code to pass ruff and black test.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes#8724 and made sure it passes doctest
Signed-off-by: Arijit De <arijitde2050@gmail.com>
* Fixed return type hinting required by pre commit for evaluate function
Signed-off-by: Arijit De <arijitde2050@gmail.com>
* Changed line 186 to return only top of stack instead of calling the get_number function as it was converting float values to int, resulting in data loss. Fixes#8754 and #8724
Signed-off-by: Arijit De <arijitde2050@gmail.com>
* Made the requested changes
Also changed the code to make the evaluate function first convert all the numbers and then process the valid expression.
* Fixes#8754, #8724 Updated postfix_evaluation.py
postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes#8724. Added a doctest example with unary operator.
* Fixes#8754, #8724 Updated postfix_evaluation.py
postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes#8724. Added a doctest example with unary operator.
* Fixes#8754, #8724 Updated the parse_token function of postfix_evaluation.py
ostfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes#8724. Added a doctest example with unary operator and invalid expression.
* Fixes#8754, #8724 Updated postfix_evaluation.py
postfix_evaluation.py now supports Unary operators and floating point numbers.
Also merged evaluate_postfix_notations.py and postfix_evaluation.py into postfix_evaluation.py which fixes#8724. Added a doctest example with unary operator and invalid expression.
* Update postfix_evaluation.py
* Update postfix_evaluation.py
* Update postfix_evaluation.py
* Update postfix_evaluation.py
* Update postfix_evaluation.py
---------
Signed-off-by: Arijit De <arijitde2050@gmail.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>
* 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>
* 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
* 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
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* Add typing
hacktoberfest
* [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>
* Update hash_table.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update hash_table.py
* Update hash_table.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Update heap_generic.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update heap_generic.py
* Update heap_generic.py
* Update heap_generic.py
* Update heap_generic.py
* Update heap_generic.py
* [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>
* 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>
* renames prime functions and occurances in comments
* changes implementation of primality testing to be uniform
* adds static typing as per conventions
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.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>
* Fix type annotations for linked_stack.py
* Replace Optional with inline union type
* Rename linked_stack to stack_with_singly_linked_list
* Rename stack_using_dll to stack_with_doubly_linked_list
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.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>