We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8cdb24 commit bdf2e8fCopy full SHA for bdf2e8f
1 file changed
data_structures/binary_tree/red_black_tree.py
@@ -9,7 +9,14 @@ class RedBlackTree:
9
"""
10
A Red-Black tree, which is a self-balancing BST (binary search
11
tree).
12
-
+ This tree has similar performance to AVL trees, but the balancing is
13
+ less strict, so it will perform faster for writing/deleting nodes
14
+ and slower for reading in the average case, though, because they're
15
+ both balanced binary search trees, both will get the same asymptotic
16
+ performance.
17
+ To read more about them, https://en.wikipedia.org/wiki/Red-black_tree
18
+ Unless otherwise specified, all asymptotic runtimes are specified in
19
+ terms of the size of the tree.
20
Examples:
21
>>> tree = RedBlackTree(0)
22
>>> tree = tree.insert(8).insert(-8).insert(4).insert(12)
0 commit comments