Skip to content

Update avl_tree.py #2145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 25, 2020
Merged

Update avl_tree.py #2145

merged 15 commits into from
Jun 25, 2020

Conversation

zky001
Copy link
Contributor

@zky001 zky001 commented Jun 22, 2020

it's true definition of AVL tree,change left and right rotation,and add avl_tree doctest

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

it's true definition of AVL tree,change  left and right rotation,and add avl_tree doctest
@TravisBuddy
Copy link

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: f92a6e90-b437-11ea-bd89-f57d85bb28d1

@TravisBuddy
Copy link

Travis tests have failed

Hey @zky001,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 4af64640-b43d-11ea-bd89-f57d85bb28d1

@zky001
Copy link
Contributor Author

zky001 commented Jun 22, 2020

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: f92a6e90-b437-11ea-bd89-f57d85bb28d1

This error is caused by flake8 W291 trailing whitespace,this whitespace is caused by my doctest's output

@zky001
Copy link
Contributor Author

zky001 commented Jun 22, 2020

Travis tests have failed

Hey @zky001,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 4af64640-b43d-11ea-bd89-f57d85bb28d1

when I delete this whitespace in my doctest, this action will raise test failed error.

@cclauss
Copy link
Member

cclauss commented Jun 22, 2020

"\n".join(line.rstrip() for line in my_doctest())

>>> t = AVLtree()
>>> t.insert(4)
insert:4
>>> t.traversale()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the method traversale() --> __str__() and then change instances of t.traversale() into str(t).

@cclauss
Copy link
Member

cclauss commented Jun 22, 2020

Also, please change isEmpty() to is_empty().

@zky001
Copy link
Contributor Author

zky001 commented Jun 22, 2020

Also, please change isEmpty() to is_empty().

thanks a lot

@TravisBuddy
Copy link

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 1fe80900-b45d-11ea-bd89-f57d85bb28d1

@TravisBuddy
Copy link

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 4feb7290-b45d-11ea-bd89-f57d85bb28d1

@TravisBuddy
Copy link

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 6ddc2190-b45e-11ea-bd89-f57d85bb28d1

update some function name and update doctest
@TravisBuddy
Copy link

Hey @zky001,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 654073f0-b469-11ea-bd89-f57d85bb28d1

change some code format to fit flake8 review
Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for ALL the cleanup!

@cclauss cclauss merged commit c7ca9cf into TheAlgorithms:master Jun 25, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Update avl_tree.py

it's true definition of AVL tree,change  left and right rotation,and add avl_tree doctest

* Update avl_tree.py

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update data_structures/binary_tree/avl_tree.py

Co-authored-by: Christian Clauss <[email protected]>

* Update avl_tree.py

update some function name and update doctest

* Update avl_tree.py

change some code format to fit flake8 review

Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants