## Print all integers that are sum of powers of two given numbers

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… Read More »

## Find closest value for every element in array

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

## Find closest smaller value for every element in array

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 »

## Find closest greater value for every element in array

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

## Closest greater or same value on left side for every element in array

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

## Double ended priority queue

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 »

## Minimum number of nodes in an AVL Tree with given height

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 »

## Longest subarray with only one value greater than k

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 »

## Queries to add, remove and return the difference of maximum and minimum.

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 »

## Red Black Tree vs AVL Tree

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 Data Structure

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 »

## Left Leaning Red Black Tree (Insertion)

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.

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 arrays

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 m

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 »