Binary Search Tree

Binary Search Tree

O(log n)Space: O(n)
Pseudocode
1procedure insert(root, value)
2 if root is null then
3 return new Node(value)
4 if value < root.value then
5 root.left ← insert(root.left, value)
6 else if value > root.value then
7 root.right ← insert(root.right, value)
8 return root