Binary Search Tree¶
Interface¶
The implementation of the binary search tree (BST).
- class TreeNode(data: int)¶
The atomic elements of the binary tree implemented with linked list.
- __init__(data: int) None¶
Initianlize a tree node.
- Variables:
data – The data of the node.
left – The pointer to the left node.
right – The pointer to the right node.
- class BST¶
Binary Search Tree impletemented with linked list.
- __init__()¶
Initianlize an empty binary search tree.
- Variables:
head – The pointer to the root node of the binary search tree.
- find(element: int) TreeNode¶
Non-recursion version of the find operation in binary search tree.
- Parameters:
element – The element to find.
- Returns:
The target node.