Binary search tree

useful in search, insertion, deletion, operation

Jiyun Park
2 min readJan 24, 2020

Binary search tree(BST) is a binary tree that is empty or each node satisfies the following properties:

  1. every element has a key, and no two elements have the same key
  2. the keys in a non-empty left subtree must be smaller than the key in the root of the subtree
  3. the keys in a non-empty right subtree must be larger than the key in the root of the subtree
  4. the left and right subtrees are also BST
iterative search of a binary search tree
inserting into a binary search tree
4 cases of deletion from a binary search tree

If you want to see the code all? 👩🏻‍💻 https://github.com/jyuunnii/Data-Structure

Time complexity of binary search trees

searching, insertion, deletion is bounded by O(h) where his the height of the binary search tree. In a good case, the height may be log n where n is the elements of the BST. On contrast, the worst case is O(n).

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response