Skip to content

Latest commit

 

History

History
174 lines (121 loc) · 3.46 KB

README.md

File metadata and controls

174 lines (121 loc) · 3.46 KB

Binary Search Tree

img

what is it

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.

costs

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)

operations

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

get minimum (recursive)
get minimum (iterative)
get maximum (recursive)
get maximum (iterative)

complete implementation

pros

cons

use cases