Skip to content

Commit ea66c22

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1fedce4 commit ea66c22

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

data_structures/binary_tree/splay_tree.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,19 @@ def delete(self, key: int) -> None:
126126
# ------------------------- TRAVERSALS -------------------------
127127
def inorder(self, root: Optional[Node]) -> List[int]:
128128
"""Returns an inorder traversal of the tree."""
129-
return [] if not root else self.inorder(root.left) + [root.key] + self.inorder(root.right)
129+
return (
130+
[]
131+
if not root
132+
else self.inorder(root.left) + [root.key] + self.inorder(root.right)
133+
)
130134

131135
def preorder(self, root: Optional[Node]) -> List[int]:
132136
"""Returns a preorder traversal of the tree."""
133-
return [] if not root else [root.key] + self.preorder(root.left) + self.preorder(root.right)
137+
return (
138+
[]
139+
if not root
140+
else [root.key] + self.preorder(root.left) + self.preorder(root.right)
141+
)
134142

135143

136144
if __name__ == "__main__":

0 commit comments

Comments
 (0)