Binary Search Tree, is a node-based binary tree data structure which has the following properties: The left subtree of a node contains only nodes with… Read More

# Tag Archives: Self-Balancing-BST

Given three non-negative integers x, y and bound, the task is to print all the powerful integer ? bound in sorted order. A powerful integer is… Read More

Given an array of integers, find the closest element for every element. Examples: Input : arr[] = {10, 5, 11, 6, 20, 12} Output :… Read More

Given an array of integers, find the closest smaller element for every element. If there is no smaller element then print -1 Examples: Input :… Read More

Given an array of integers, find the closest greater element for every element. If there is no greater element then print -1Examples: Input : arr[]… Read More

Given an array of integers, find the closest (not considering the distance, but value) greater or the same value on the left of every element.… Read More

A double ended priority queue supports operations of both max heap (a max priority queue) and min heap (a min priority queue). The following operations… Read More

Given the height of an AVL tree ‘h’, the task is to find the minimum number of nodes the tree can have. Examples : Input… Read More

Given an array of N numbers, find length of the longest subarray such that K is the second largest element on insertion. Examples: Input: a[] =… Read More

Given Q queries. The queries are of three types and are described below: Add the number num to the list. Remove the number num from… Read More

In this post we will compare Red Black Tree and AVL Tree. Red Black Tree: Properties: Self-Balancing is provided by painting each node with one… Read More

Tango Tree is an online algorithm. It is a type of binary search tree. It is better than the offline weight balanced binary search tree… Read More

Prerequisites : Red – Black Trees. A left leaning Red Black Tree or (LLRB), is a variant of red black tree, which is a lot… Read More

You are given an array of n integer and an integer K. Find the number of total unordered pairs {i, j} such that absolute value… Read More

Given two sorted arrays, we can get a set of sums(add one element from the first and one from second). Find the N’th element in… Read More