Skip to content

Commit 22f137d

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

data_structures/binary_tree/splay_tree.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
For Hacktoberfest contribution. Please label 'hacktoberfest-accepted'.
55
"""
66

7+
78
class Node:
89
def __init__(self, key):
910
self.left = None
1011
self.right = None
1112
self.parent = None
1213
self.key = key
1314

15+
1416
class SplayTree:
1517
def __init__(self):
1618
self.root = None
@@ -114,11 +116,12 @@ def inorder(self, node=None, result=None):
114116
self.inorder(node.right, result)
115117
return result
116118

119+
117120
# Example Usage / Test
118121
if __name__ == "__main__":
119122
tree = SplayTree()
120123
for key in [10, 20, 30, 40, 50, 25]:
121124
tree.insert(key)
122-
print(tree.inorder()) # Output should be the inorder traversal of tree
125+
print(tree.inorder()) # Output should be the inorder traversal of tree
123126
found = tree.search(30)
124127
print(f"Found: {found.key if found else None}")

0 commit comments

Comments
 (0)