A binary search tree is a tree data structure where:
- The nodes to the left are smaller than the current node.
- The nodes to the right are larger than the current node.
BST | avarage | worst |
---|---|---|
Access | O(log(n)) | O(n) |
Search | O(log(n)) | O(n) |
Insertion | O(log(n)) | O(n) |
Deletion | O(log(n)) | O(n) |
Space | O(n) |
insertion
search
deletion
inorder traversal
Inorder traversal can be used to sort the binary tree
preorder traversal
preorder Traversal can be used to copy the binary tree
postorder traversal
postorder Traversal can be used to delete the binary tree