# Tag Archives: Self-Balancing-BST

## Left Leaning Red Black Tree (Insertion)October 24, 2017

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 »

## Minimum Possible value of |ai + aj – k| for given array and k.October 6, 2017

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 »

## Find N’th item in a set formed by sum of two arraysMarch 12, 2017

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 »

## Maximum subarray sum modulo mMarch 2, 2017

Given an array of n elements and an integer m. The task is to find the maximum value of the sum of its subarray modulo… Read More »

## ScapeGoat Tree | Set 1 (Introduction and Insertion)February 13, 2017

A ScapeGoat tree is a self-balancing Binary Search Tree like AVL Tree, Red-Black Tree, Splay Tree, ..etc. Search time is O(Log n) in worst case.… Read More »

## Sort an array according to absolute difference with given valueDecember 22, 2016

Given an array of n distinct elements and a number x, arrange array elements according to the absolute difference with x, i. e., element having… Read More »

## Maximum product of an increasing subsequence of size 3December 17, 2016

Given an array of distinct positive integers, the task is to find the maximum product of increasing subsequence of size 3, i.e., we need to… Read More »

## Tree SortOctober 19, 2016

Tree sort is a sorting algorithm that is based on Binary Search Tree data structure. It first creates a binary search tree from the elements… Read More »

## proto van Emde Boas Trees | Set 1 (Background and Introduction)October 10, 2016

Let us consider the below problem statement and think of different solutions for it. Given a set S of elements such that the elements are… Read More »

## Overview of Data Structures | Set 2 (Binary Tree, BST, Heap and Hash)February 8, 2016

We have discussed Overview of Array, Linked List, Queue and Stack. In this article following Data Structures are discussed. 5. Binary Tree 6. Binary Search… Read More »

## Treap (A Randomized Binary Search Tree)October 22, 2015

Like Red-Black and AVL Trees, Treap is a Balanced Binary Search Tree, but not guaranteed to have height as O(Log n). The idea is to… Read More »

## Why is Binary Heap Preferred over BST for Priority Queue?September 7, 2015

A typical Priority Queue requires following operations to be efficient. Get Top Priority Element (Get minimum or maximum) Insert an element Remove top priority element… Read More »

## How to sort a big array with many repetitions?July 10, 2015

Consider a big array where elements are from a small set and in any range, i.e. there are many repetitions. How to efficiently sort the… Read More »

## How to handle duplicates in Binary Search Tree?May 11, 2015

In a Binary Search Tree (BST), all keys in left subtree of a key must be smaller and all keys in right subtree must be… Read More »

## Advantages of BST over Hash TableApril 1, 2015

Hash Table supports following operations in Θ(1) time.