Monday, November 24, 2025
HomeData Modelling & AIDifferent shapes of AVL possible at height h

Different shapes of AVL possible at height h

AVL Tree: It is a self-balancing Binary Search Tree where the Balance Factor cannot be more than one for all nodes. Balance Factor can be defined as the difference between heights of left and right subtree.

Example:

The task is to find the possible number of different shapes of a minimal AVL tree of height h can be formed. This can be understood by creating trees and then generating a generalized formula for this computation.

Solution:

Let N(h) denotes the number of possibilities of trees and h denotes the height of the AVL tree. In the figure below, possible trees are shaped along with their height. In the first column, height analysis is shown and in the second column, possible trees are shown.

Let us now generalize the above observations:

The formula can be generalized as:

N(h) = 2 * N(h - 1) * N (h - 2)

Feeling lost in the world of random DSA topics, wasting time without progress? It’s time for a change! Join our DSA course, where we’ll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!

RELATED ARTICLES

Most Popular

Dominic
32410 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6785 POSTS0 COMMENTS
Nicole Veronica
11932 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12000 POSTS0 COMMENTS
Shaida Kate Naidoo
6909 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6865 POSTS0 COMMENTS
Umr Jansen
6852 POSTS0 COMMENTS