File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
data_structures/binary_tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,14 @@ class RedBlackTree:
9
9
"""
10
10
A Red-Black tree, which is a self-balancing BST (binary search
11
11
tree).
12
-
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.
13
20
Examples:
14
21
>>> tree = RedBlackTree(0)
15
22
>>> tree = tree.insert(8).insert(-8).insert(4).insert(12)
You can’t perform that action at this time.
0 commit comments