# Category Archives: Advanced Data Structure

## Number of elements less than or equal to a given number in a given subarray | Set 2 (Including Updates)June 18, 2017

Given an array ‘a[]’ and number of queries q there will be two type of queries Query 0 update(i, v) : Two integers i and… Read More »

## Segment Tree | Set 3 (XOR of given range)June 14, 2017

We have an array arr[0 . . . n-1]. There are two type of queries Find the XOR of elements from index l to r… Read More »

## Merge Sort Tree (Smaller or equal elements in given row range)

Given an array where each element is a vector containing integers in sorted order. The task is to answer following queries: count(start, end, k) :… Read More »

## Splay Tree | Set 3 (Delete)June 13, 2017

It is recommended to refer following post as prerequisite of this post. Splay Tree | Set 1 (Search) Following are the different cases to delete… Read More »

## Quad TreeJune 12, 2017

Quadtrees are trees used to efficiently store data of points on a two-dimensional space. In this tree, each node has at most four children. We… Read More »

## Number of elements less than or equal to a given number in a given subarrayJune 11, 2017

Given an array ‘a[]’ and number of queries q. Each query can be represented by l, r, x. Your task is to print the number… Read More »

## Auto-complete feature using TrieJune 7, 2017

We are given a Trie with a set of strings stored in it. Now the user types in a prefix of his search query, we… Read More »

## Dynamic Connectivity | Set 1 (Incremental)June 5, 2017

Dynamic connectivity is a data structure that dynamically maintains the information about thee connected components of graph. In simple words suppose there is a graph… Read More »

## Reconstructing Segment TreeMay 28, 2017

We are given 2*N – 1 integers. We need to check whether it is possible to construct a Range Minimum Query segment tree for an… Read More »

## Ropes Data Structure (Fast String Concatenation)May 24, 2017

One of the most common operations on strings is appending or concatenation. Appending to the end of a string when the string is stored in… Read More »

## Left-Child Right-Sibling Representation of TreeMay 23, 2017

An n-ary tree in computer science is a collection of nodes normally represented hierarchically in the following fashion. The tree starts at the root node.… Read More »

## Find whether a subarray is in form of a mountain or notMay 15, 2017

We are given an array of integers and a range, we need to find whether the subarray which falls in this range has values in… Read More »

## Print Kth character in sorted concatenated substrings of a stringApril 29, 2017

Given a string of lower alphabetic characters, find K-th character in a string formed by substrings (of given string) when concatenated in sorted form. Examples:… Read More »

## Substring with highest frequency length productApril 19, 2017

Given a string which contains lower alphabetic characters, we need to find out such a substring of this string whose product of length and frequency… Read More »

## BK-Tree | Introduction & ImplementationMarch 27, 2017

BK Tree or Burkhard Keller Tree is a data structure that is used to perform spell check based on Edit Distance (Levenshtein distance) concept. BK… Read More »