mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8 * Fix some tests * Fix some E741 * Fix some E741 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -89,8 +89,8 @@ def leftrotation(node):
|
||||
Bl Br UB Br C
|
||||
/
|
||||
UB
|
||||
|
||||
UB = unbalanced node
|
||||
|
||||
UB = unbalanced node
|
||||
"""
|
||||
print("left rotation node:", node.getdata())
|
||||
ret = node.getleft()
|
||||
@ -120,11 +120,11 @@ def rightrotation(node):
|
||||
|
||||
def rlrotation(node):
|
||||
r"""
|
||||
A A Br
|
||||
A A Br
|
||||
/ \ / \ / \
|
||||
B C RR Br C LR B A
|
||||
/ \ --> / \ --> / / \
|
||||
Bl Br B UB Bl UB C
|
||||
Bl Br B UB Bl UB C
|
||||
\ /
|
||||
UB Bl
|
||||
RR = rightrotation LR = leftrotation
|
||||
@ -276,13 +276,13 @@ class AVLtree:
|
||||
if __name__ == "__main__":
|
||||
t = AVLtree()
|
||||
t.traversale()
|
||||
l = list(range(10))
|
||||
random.shuffle(l)
|
||||
for i in l:
|
||||
lst = list(range(10))
|
||||
random.shuffle(lst)
|
||||
for i in lst:
|
||||
t.insert(i)
|
||||
t.traversale()
|
||||
|
||||
random.shuffle(l)
|
||||
for i in l:
|
||||
random.shuffle(lst)
|
||||
for i in lst:
|
||||
t.del_node(i)
|
||||
t.traversale()
|
||||
|
Reference in New Issue
Block a user