MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

data_structures/binary_tree/red_black_tree.py:20–39  ·  view source on GitHub ↗

Initialize a new Red-Black Tree node with the given values: label: The value associated with this node color: 0 if black, 1 if red parent: The parent to this node left: This node's left child right: This node's right child

(
        self,
        label: int | None = None,
        color: int = 0,
        parent: RedBlackTree | None = None,
        left: RedBlackTree | None = None,
        right: RedBlackTree | None = None,
    )

Source from the content-addressed store, hash-verified

18 """
19
20 def __init__(
21 self,
22 label: int | None = None,
23 color: int = 0,
24 parent: RedBlackTree | None = None,
25 left: RedBlackTree | None = None,
26 right: RedBlackTree | None = None,
27 ) -> None:
28 """Initialize a new Red-Black Tree node with the given values:
29 label: The value associated with this node
30 color: 0 if black, 1 if red
31 parent: The parent to this node
32 left: This node's left child
33 right: This node's right child
34 """
35 self.label = label
36 self.parent = parent
37 self.left = left
38 self.right = right
39 self.color = color
40
41 # Here are functions which are specific to red-black trees
42

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected