-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Only one carriage return #2155
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
l3str4nge
merged 10 commits into
TheAlgorithms:master
from
cclauss:only-one-carriage-return
Jun 25, 2020
Merged
Only one carriage return #2155
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
307f09e
updating DIRECTORY.md
a95fb08
Merge branch 'master' of https://github.com/cclauss/Python-3
cclauss 142cb8c
Merge branch 'master' of https://github.com/TheAlgorithms/Python
cclauss a97691b
touch
cclauss 4978f84
fixup! Format Python code with psf/black push
29bc79a
Update word_frequency_functions.py
cclauss fe5973e
updating DIRECTORY.md
30fc106
Update word_frequency_functions.py
cclauss c6ad52b
Update lfu_cache.py
cclauss 7f2b8a8
Update sol1.py
cclauss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,14 +204,16 @@ def del_node(root, data): | |
if root is None: | ||
return root | ||
if get_height(root.get_right()) - get_height(root.get_left()) == 2: | ||
if get_height(root.get_right().get_right()) > \ | ||
get_height(root.get_right().get_left()): | ||
if get_height(root.get_right().get_right()) > get_height( | ||
root.get_right().get_left() | ||
): | ||
root = left_rotation(root) | ||
else: | ||
root = rl_rotation(root) | ||
elif get_height(root.get_right()) - get_height(root.get_left()) == -2: | ||
if get_height(root.get_left().get_left()) > \ | ||
get_height(root.get_left().get_right()): | ||
if get_height(root.get_left().get_left()) > get_height( | ||
root.get_left().get_right() | ||
): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
root = right_rotation(root) | ||
else: | ||
root = lr_rotation(root) | ||
|
@@ -253,6 +255,7 @@ class AVLtree: | |
2 * | ||
************************************* | ||
""" | ||
|
||
def __init__(self): | ||
self.root = None | ||
|
||
|
@@ -307,6 +310,7 @@ def __str__(self): # a level traversale, gives a more intuitive look on the tre | |
|
||
def _test(): | ||
import doctest | ||
|
||
doctest.testmod() | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's unreadable 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first variable would be
right_right_height
which is no more readable thanget_height(root.get_right().get_right())
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cclauss Could we refactor this in this pr? If not i will approve it without and open new with refactor.