# Category Archives: Advanced Data Structure

## Print Kth character in sorted concatenated substrings of a string

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 product

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 & Implementation

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 »

## Palindromic Tree | Introduction & Implementation

We encounter various problems like Maximum length palindrome in a string, number of palindromic substrings and many more interesting problems on palindromic substrings . Mostly… Read More »

## Word formation using concatenation of two dictionary words

Given a dictionary find out if given word can be made by two words in the dictionary. Note: Words in the dictionary must be unique… Read More »

## Palindrome pair in an array of words (or strings)

Given a list of words, find if any of the two words can be joined to form a palindrome. Examples: Input : list[] = {“geekf”,… Read More »

## Print all valid words that are possible using Characters of Array

Given a dictionary and a character array, print all valid words that are possible using characters from the array. Examples: Input : Dict – {“go”,”bat”,”me”,”eat”,”goal”,… Read More »

## LCA for n-ary Tree | Constant Query O(1)

We have seen various methods with different Time Complexities to calculate LCA in n-ary tree:- Method 1 : Naive Method ( by calculating root to… Read More »

## ScapeGoat Tree | Set 1 (Introduction and Insertion)

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 »

## Boggle | Set 2 (Using Trie)

Given a dictionary, a method to do lookup in dictionary and a M x N board where every cell has one character. Find all possible… Read More »

## Persistent Segment Tree | Set 1 (Introduction)

Prerequisite : Segment Tree Persistency in Data Structure Segment Tree is itself a great data structure that comes into play in many cases. In this… Read More »

## Sqrt (or Square Root) Decomposition | Set 2 (LCA of Tree in O(sqrt(height)) time)

Prerequisite : Introduction and DFS The task is to find LCA of two given nodes in a tree (not necessarily a Binary Tree). In previous… Read More »

## Queries on substring palindrome formation

Given a string S, and two type of queries. Type 1: 1 L x, Indicates update Lth index of string S by x character. Type… Read More »

## Weighted Prefix Search

Given n strings and a weight associated with each string. The task is to find the maximum weight of string having the given prefix. Print… Read More »

## LCA for general or n-ary trees (Sparse Matrix DP approach < O(nlogn), O(logn)>)

In previous posts, we have discussed how to calculate the Lowest Common Ancestor (LCA) for a binary tree and a binary search tree (this, this… Read More »