What is BST?
Binary Search Algorithm is a search algorithm that has O(logn) complexity.
Step to preform 'search' function in BST
- Check current(or first) node's value
- If current node's value is not what we what, compare it with value we want
- If value is bigger than current node, go to the right subtree
- If value is smaller than current node, go the left subtree
- Keep comparing nodes until you find the correct one or reach the end of tree
Image about BST
Extra link about BST
Here is a link that introduce Binary Search Tree.