Open In App

Difference between Binary Search Tree and AVL Tree

Improve
Improve
Like Article
Like
Save
Share
Report

Binary Search Tree:

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.

Binary Search Tree

AVL Tree: 

AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one.

AVL Tree

Difference between Binary Search Tree and AVL Tree

Binary Search Tree AVL Tree
In Binary Search Tree, In AVL Tree, every node does not follow the balance factor. In AVL Tree, every node follows the balance factor i.e. 0, 1, -1.
Every Binary Search tree is not an AVL tree. Every AVL tree is a Binary Search tree.
Simple to implement. Complex to implement.
The height or depth of the tree is O(n). The height or depth of the tree is O(logn)
Searching is not efficient when there are a large number of nodes in the Binary Search tree.  Searching is efficient because searching for the desired node is faster due to the balancing of height. 
The Binary Search tree structure consists of 3 fields left subtree, data, and right subtree.  AVL tree structure consists of 4 fields left subtree, data, right subtree, and balancing factor.
It is not a balanced tree. It is a balanced tree.
In Binary Search tree. Insertion and deletion are easy because no rotations are required.  In an AVL tree, Insertion and deletion are complex as it requires multiple rotations to balance the tree.

Last Updated : 27 Feb, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads