Explain the difference between Binary Tree and Binary Search Tree with an example?

Technology CommunityCategory: Binary TreeExplain the difference between Binary Tree and Binary Search Tree with an example?
VietMX Staff asked 3 years ago

Binary tree: Tree where each node has up to two leaves

  1
 / \
2   3

Binary Search Tree (BST): Used for searching. A binary tree where the left child contains only nodes with values less than the parent node, and where the right child only contains nodes with values greater than or equal to the parent.

  2
 / \
1   3