Skip to content
Related Articles

Related Articles

Difference between Binary Tree and Binary Search Tree

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 26 Jul, 2022
Improve Article
Save Article

Binary Tree Data Structure 

A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right children. 

Binary Search Tree Data Structure 

A binary Search Tree is a node-based binary tree data structure that has the following properties:  

  • The left subtree of a node contains only nodes with keys lesser than the node’s key.
  • The right subtree of a node contains only nodes with keys greater than the node’s key.
  • The left and right subtree each must also be a binary search tree.
  • There must be no duplicate nodes.

Difference between Binary Tree and Binary Search Tree:  

S. No.Basis of ComparisonBINARY TREEBINARY SEARCH TREE
1.DefinitionBINARY TREE is a nonlinear data structure where each node can have at most two child nodes. BINARY SEARCH TREE is a node based binary tree that further has right and left subtree that too are binary search tree.
2.Types
  • Full binary tree
  • Complete binary tree
  • Extended Binary tree and more
  • AVL tree
  • Splay Tree
  • T-trees and more
3.OperationsBINARY TREE is unordered hence slower in process of insertion, deletion, and searching.Insertion, deletion, searching of an element is faster in BINARY SEARCH TREE than BINARY TREE due to the ordered characteristics
4.StructureIn BINARY TREE there is no ordering in terms of how the nodes are arrangedIn BINARY SEARCH TREE the left subtree has elements less than the nodes element and the right subtree has elements greater than the nodes element.
5.Data RepresentationData Representation is carried out in a hierarchical format.Data Representation is carried out in the ordered format.
6.Duplicate ValuesBinary trees allow duplicate values.Binary Search Tree does not allow duplicate values.
7.SpeedThe speed of deletion, insertion, and searching operations in Binary Tree is slower as compared to Binary Search Tree because it is unordered. Because the Binary Search Tree has ordered properties, it conducts element deletion, insertion, and searching faster.
8.ComplexityTime complexity is usually O(n).Time complexity is usually O(logn).
9.ApplicationIt is used for retrieval of fast and quick information and data lookup.It works well at element deletion, insertion, and searching.
10.UsageIt serves as the foundation for implementing Full Binary Tree, BSTs, Perfect Binary Tree, and others. It is utilized in the implementation of Balanced Binary Search Trees such as AVL Trees, Red Black Trees, and so on.

 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!