## Red-Black Tree | Set 2 (Insert)

In the previous post, we discussed introduction to Red-Black Trees. In this post, insertion is discussed. In AVL tree insertion, we used rotation as a… Read More »

## Red-Black Tree | Set 1 (Introduction)

Red-Black Tree is a self-balancing Binary Search Tree (BST) where every node follows following rules. 1) Every node has a color either red or black.… Read More »

## Splay Tree | Set 2 (Insert)

It is recommended to refer following post as prerequisite of this post. Splay Tree | Set 1 (Search) As discussed in the previous post, Splay… Read More »

## Splay Tree | Set 1 (Search)

The worst case time complexity of Binary Search Tree (BST) operations like search, delete, insert is O(n). The worst case occurs when the tree is… Read More »

## Introduction of B-Tree

B-Tree is a self-balancing search tree. In most of the other self-balancing search trees (like AVL and Red-Black Trees), it is assumed that everything is… Read More »

## Merge Two Balanced Binary Search Trees

You are given two balanced binary search trees e.g., AVL or Red Black Tree. Write a function that merges the two given balanced BSTs into… Read More »

## AVL Tree | Set 2 (Deletion)

We have discussed AVL insertion in the previous post. In this post, we will follow a similar approach for deletion. Steps to follow for deletion.… Read More »

## AVL Tree | Set 1 (Insertion)

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

## Count smaller elements on right side

Write a function to count number of smaller elements on right of each element in an array. Given an unsorted array arr[] of distinct integers,… Read More »

## Applications of tree data structure

Why Tree? Unlike Array and Linked List, which are linear data structures, tree is hierarchical (or non-linear) data structure. One reason to use trees might… Read More »

## How to determine if a binary tree is height-balanced?

A tree where no leaf is much farther away from the root than any other leaf. Different balancing schemes allow different definitions of “much farther”… Read More »