Skip to content

Commit bdf2e8f

Browse files
authored
Update red_black_tree.py
1 parent e8cdb24 commit bdf2e8f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

data_structures/binary_tree/red_black_tree.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ class RedBlackTree:
99
"""
1010
A Red-Black tree, which is a self-balancing BST (binary search
1111
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.
1320
Examples:
1421
>>> tree = RedBlackTree(0)
1522
>>> tree = tree.insert(8).insert(-8).insert(4).insert(12)

0 commit comments

Comments
 (0)