# Category Archives: Advanced Data Structure

## Design an efficient data structure for given operationsFebruary 8, 2013

Design a Data Structure for the following operations. The data structure should be efficient enough to accommodate the operations according to their frequency.

## Segment Tree | Set 2 (Range Minimum Query)January 29, 2013

We have introduced segment tree with a simple example in the previous post. In this post, Range Minimum Query problem is discussed as another example where Segment Tree can be used.

## Segment Tree | Set 1 (Sum of given range)January 16, 2013

Let us consider the following problem to understand Segment Trees. We have an array arr[0 . . . n-1]. We should be able to 1 Find the sum of elements from index l to r where 0 <= l <= r <= n-1 2 Change value of a specified element of the array to a… Read More »

## Ternary Search TreeJanuary 13, 2013

A ternary search tree is a special trie data structure where the child nodes of a standard trie are ordered as a binary search tree.

## Pattern Searching | Set 8 (Suffix Tree Introduction)January 7, 2013

Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may assume that n > m.

## Given a sequence of words, print all anagrams together | Set 2October 25, 2012

Given an array of words, print all anagrams together. For example, if the given array is {“cat”, “dog”, “tac”, “god”, “act”}, then output may be “cat tac act dog god”.

## Print unique rows in a given boolean matrixSeptember 28, 2012

Given a binary matrix, print all unique rows of the given matrix.

## Implement LRU Cache

How to implement LRU caching scheme? What data structures should be used? We are given total possible page numbers that can be referred. We are also given cache (or memory) size (Number of page frames that cache can hold at a time). The LRU caching scheme is to remove the least recently used frame when… Read More »

## Sort numbers stored on different machinesSeptember 26, 2012

Given N machines. Each machine contains some numbers in sorted form. But the amount of numbers, each machine has is not fixed. Output the numbers from all the machine in sorted non-decreasing form.

## Find the k most frequent words from a file

Given a book of words. Assume you have enough main memory to accommodate all words. design a data structure to find top K maximum occurring words. The data structure should be dynamic so that new words can be added.

## XOR Linked List – A Memory Efficient Doubly Linked List | Set 2June 14, 2012

In the previous post, we discussed how a Doubly Linked can be created using only one space for address field with every node.