# Category Archives: Advanced Data Structure

## Longest word in ternary search tree

Given a set of words represented in a ternary search tree, find the length of largest word among them. Examples: Input : {“Prakriti”, “Raghav”, “Rashi”,… Read More »

## Counting the number of words in a Trie

A Trie is used to store dictionary words so that they can be searched efficiently and prefix search can be done. The task is to… Read More »

## Order statistic tree using fenwick tree (BIT)

Given an array of integers with limited range (0 to 1000000). We need to implement an Order statistic tree using fenwick tree. It should support… Read More »

## Leftist Tree / Leftist Heap

A leftist tree or leftist heap is a priority queue implemented with a variant of a binary heap. Every node has an s-value (or rank… Read More »

## Trie | (Display Content)

Trie is an efficient information retrieval data structure. In our previous post on trie we have discussed about basics of trie and how to insert… Read More »

## Ternary Search Tree (Deletion)

In the SET 1 post on TST we have described how to insert and search a node in TST. In this article we will discuss… Read More »

## Skip List | Set 3 (Searching and Deletion)

In previous article Skip List | Set 2 (Insertion) we discussed the structure of skip nodes and how to insert an element in the skip… Read More »

## Skip List | Set 2 (Insertion)

We have already discussed the idea of Skip list and how they work in Skip List | Set 1 (Introduction). In this article, we will… Read More »

## Find maximum XOR of given integer in a stream of integers

You are given a number of queries Q and each query will be of the following types: Query 1 : add(x) This means add x… Read More »

Quadtrees are an effective method to store and locate data of points in a two-dimensional plane. Another effective use of quadtrees is in the field… Read More »

## Queries for number of distinct elements in a subarray

Given a array ‘a[]’ of size n and number of queries q. Each query can be represented by two integers l and r. Your task… Read More »

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

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)

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)

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 »