## Generic Linked List in C

Unlike C++ and Java, C doesn’t support generics. How to create a linked list in C that can be used for any data type? In… Read More »

## Suffix Tree Application 6 – Longest Palindromic Substring

Given a string, find the longest substring which is palindrome. We have already discussed Naïve [O(n3)], quadratic [O(n2)] and linear [O(n)] approaches in Set 1,… Read More »

## How to Implement Forward DNS Look Up Cache?

We have discussed implementation of Reverse DNS Look Up Cache. Forward DNS look up is getting IP address for a given domain name typed in… Read More »

## Binary Indexed Tree or Fenwick Tree

Let us consider the following problem to understand Binary Indexed Tree. We have an array arr[0 . . . n-1]. We would like to 1… Read More »

## How to Implement Reverse DNS Look Up Cache?

Reverse DNS look up is using an internet IP address to find a domain name. For example, if you type 74.125.200.106 in browser, it automatically… Read More »

## Suffix Tree Application 5 – Longest Common Substring

Given two strings X and Y, find the Longest Common Substring of X and Y. Naive [O(N*M2)] and Dynamic Programming [O(N*M)] approaches are already discussed… Read More »

## Generalized Suffix Tree 1

In earlier suffix tree articles, we created suffix tree for one string and then we queried that tree for substring check, searching all patterns, longest… Read More »

## Suffix Tree Application 4 – Build Linear Time Suffix Array

Given a string, build it’s Suffix Array We have already discussed following two ways of building suffix array: Naive O(n2Logn) algorithm Enhanced O(nLogn) algorithm Please… Read More »

## Suffix Tree Application 3 – Longest Repeated Substring

Given a text string, find Longest Repeated Substring in the text. If there are more than one Longest Repeated Substrings, get any one of them.… Read More »

## Suffix Tree Application 2 – Searching All Patterns

Given a text string and a pattern string, find all occurrences of the pattern in string. Few pattern searching algorithms (KMP, Rabin-Karp, Naive Algorithm, Finite… Read More »

## Suffix Tree Application 1 – Substring Check

Given a text string and a pattern string, check if a pattern exists in text or not. Few pattern searching algorithms (KMP, Rabin-Karp, Naive Algorithm,… Read More »