Commit Graph

11 Commits

Author SHA1 Message Date
aryan1165
18cdbc4165
binary_search_traversals.py made memory-friendly using generators. Fixes #8725 completely. (#9237)
* 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
2023-10-01 12:54:05 -04:00
aryan1165
eaa87bd791
Made binary tree memory-friendly using generators based travels. Fixes (#9208)
#8725
2023-10-01 04:43:48 -04: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
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
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
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 (#6245)
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0

* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Dylan Buchi
bf6db32ec2
[mypy] Fix type annotations for binary tree traversals in data structures (#5556)
* [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>
2021-10-28 22:05:31 +08:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
Christian Clauss
69457357e8
binary_tree_traversals.py: Simplify with dataclasses (#4336)
* binary_tree_traversals.py: Simplify with dataclasses

* Update data_structures/binary_tree/binary_tree_traversals.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* Optional["Node"]

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-04-26 10:15:26 +05:30
Anshraj Shrivastava
e035c6164f
add binary_tree_traversals.py to data_structures (#3297)
* add binary_tree_traversals.py to data_structures

I have added some interesting binary tree traversing methods.

* Fixed error

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update binary_tree_traversals.py

* Update binary_tree_traversals.py

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update binary_tree_traversals.py

* Update data_structures/binary_tree/binary_tree_traversals.py

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

* Update binary_tree_traversals.py

* Doctests and type hints

* Add spaces

* Update binary_tree_traversals.py

* black exclude data_structures/binary_tree/binary_tree_traversals.py

* Add spaces again

* Update binary_tree_traversals.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-15 13:09:59 +02:00