Only one carriage return (#2155)

* updating DIRECTORY.md

* touch

* fixup! Format Python code with psf/black push

* Update word_frequency_functions.py

* updating DIRECTORY.md

* Update word_frequency_functions.py

* Update lfu_cache.py

* Update sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Christian Clauss
2020-06-25 19:15:30 +02:00
committed by GitHub
parent d2fa91b18e
commit 8ab84fd794
7 changed files with 77 additions and 68 deletions

View File

@ -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()
):
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 @@ class AVLtree:
def _test():
import doctest
doctest.testmod()