Normal Binary Tree¶
Interface¶
The implementation of the binary tree.
- class TreeNode(data: int | None = None)¶
The node of the binary tree.
- Variables:
data – The data of the node.
left – The pointer to the left child
right – The pointer to the right child
- class BinaryTree¶
The binary tree impelemented with linked list.
- Variables:
head – The pointer to the tree node.
- pre_order_traversal(node: TreeNode | None | Literal['default'] = 'default') None¶
The pre-order traversal impelementaiton with recursion.
- in_order_traversal() None¶
The in-order traversal implementation with stack.
- post_order_traversal() None¶
Not implemented.