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

Class Node

data_structures/binary_tree/symmetric_tree.py:14–35  ·  view source on GitHub ↗

A Node represents an element of a binary tree, which contains: Attributes: data: The value stored in the node (int). left: Pointer to the left child node (Node or None). right: Pointer to the right child node (Node or None). Example: >>> node = Node(1, Node(2), Node(3)

Source from the content-addressed store, hash-verified

12
13@dataclass
14class Node:
15 """
16 A Node represents an element of a binary tree, which contains:
17
18 Attributes:
19 data: The value stored in the node (int).
20 left: Pointer to the left child node (Node or None).
21 right: Pointer to the right child node (Node or None).
22
23 Example:
24 >>> node = Node(1, Node(2), Node(3))
25 >>> node.data
26 1
27 >>> node.left.data
28 2
29 >>> node.right.data
30 3
31 """
32
33 data: int
34 left: Node | None = None
35 right: Node | None = None
36
37
38def make_symmetric_tree() -> Node:

Callers 2

make_symmetric_treeFunction · 0.70
make_asymmetric_treeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected