Skip to content

Commit c60d58d

Browse files
committed
Remove extra blank lines
1 parent ec6b94d commit c60d58d

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

Diff for: data_structures/binary_tree/red_black_tree.py

-17
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,13 @@ def rotate_left(self) -> RedBlackTree:
5151
"""
5252
parent = self.parent
5353
right = self.right
54-
5554
if right is None:
5655
return self
57-
5856
self.right = right.left
59-
6057
if self.right:
6158
self.right.parent = self
6259
self.parent = right
63-
6460
right.left = self
65-
6661
if parent is not None:
6762
if parent.left == self:
6863
parent.left = right
@@ -80,14 +75,10 @@ def rotate_right(self) -> RedBlackTree:
8075
return self
8176
parent = self.parent
8277
left = self.left
83-
8478
self.left = left.right
85-
8679
if self.left:
8780
self.left.parent = self
88-
8981
self.parent = left
90-
9182
left.right = self
9283

9384
if parent is not None:
@@ -186,7 +177,6 @@ def remove(self, label: int) -> RedBlackTree:
186177
# is if both children are None leaves.
187178
# We can just remove this node and call it a day.
188179
if self.parent:
189-
190180
if self.is_left():
191181
self.parent.left = None
192182
else:
@@ -314,21 +304,17 @@ def check_color_properties(self) -> bool:
314304
"""
315305
# I assume property 1 to hold because there is nothing that can
316306
# make the color be anything other than 0 or 1.
317-
318307
# Property 2
319308
if self.color:
320309
# The root was red
321310
print("Property 2")
322311
return False
323-
324312
# Property 3 does not need to be checked, because None is assumed
325313
# to be black and is all the leaves.
326-
327314
# Property 4
328315
if not self.check_coloring():
329316
print("Property 4")
330317
return False
331-
332318
# Property 5
333319
if self.black_height() is None:
334320
print("Property 5")
@@ -385,7 +371,6 @@ def search(self, label: int) -> RedBlackTree | None:
385371
"""
386372
if self.label == label:
387373
return self
388-
389374
elif self.label is not None and label > self.label:
390375
if self.right is None:
391376
return None
@@ -474,7 +459,6 @@ def is_left(self) -> bool:
474459
"""Returns true iff this node is the left child of its parent."""
475460
if self.parent is None:
476461
return False
477-
478462
return self.parent.left is self.parent.left is self
479463

480464
def is_right(self) -> bool:
@@ -491,7 +475,6 @@ def __len__(self) -> int:
491475
Return the number of nodes in this tree.
492476
"""
493477
ln = 1
494-
495478
if self.left:
496479
ln += len(self.left)
497480
if self.right:

0 commit comments

Comments
 (0)