img
Question:
Published on: 25 April, 2024

What are the differences between AVL Tree & Binary Search Tree ?

Answer:

A binary search tree (BST) is a binary tree data structure which has the following properties:

->each node has a value;
->a total order is defined on these values;
->the left subtree of a node contains only values less than the node's value;
->the right subtree of a node contains only values greater than or equal to the node's value.


An AVL tree is a self-balancing binary search tree.
In an AVL tree the heights of the two child subtrees of any node differ by at most one, therefore it is also called height-balanced. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases. Additions and deletions may require the tree to be rebalanced by one or more tree rotations.

Random questions