## Boyer Moore Algorithm | Good Suffix heuristic

We have already discussed Bad character heuristic variation of Boyer Moore algorithm. In this article we will discuss Good Suffix heuristic for pattern searching. Just… Read More »

## is_permutation() in C++ and its application for anagram search

is_permutations() is used to check if two containers like string and vector are permutation of each other. It accepts three parameters, the first two parameters… Read More »

## Match Expression where a single special character in pattern can match one or more characters

Given two string, in which one is pattern (Pattern) and other is searching expression. Searching expression contains ‘#’. The # works in following way: A… Read More »

## Maximum length prefix of one string that occurs as subsequence in another

Given two strings s and t. The task is to find maximum length of some prefix of the string S which occur in string t… Read More »

## Replace all occurrences of string AB with C without using extra space

Given a string str that may contain one more occurrences of “AB”. Replace all occurrences of “AB” with “C” in str. Examples: Input : str… Read More »

## Wildcard Pattern Matching

Given a text and a wildcard pattern, implement wildcard pattern matching algorithm that finds if wildcard pattern is matched with text. The matching should cover… Read More »

## Find all occurrences of a given word in a matrix

Given a 2D grid of characters and a word, find all occurrences of given word in grid. A word can be matched in all 8… Read More »

## Aho-Corasick Algorithm for Pattern Searching

Given an input text and an array of k words, arr[], find all occurrences of all words in the input text. Let n be the… Read More »

## ­­kasai’s Algorithm for Construction of LCP array from Suffix Array

Background Suffix Array : A suffix array is a sorted array of all suffixes of a given string. Let the given string be “banana”. 0… Read More »

## Search a Word in a 2D Grid of characters

Given a 2D grid of characters and a word, find all occurrences of given word in grid. A word can be matched in all 8… Read More »

## Z algorithm (Linear time pattern searching Algorithm)

This algorithm finds all occurrences of a pattern in a text in linear time. Let length of text be n and of pattern be m,… Read More »

## Online algorithm for checking palindrome in a stream

Given a stream of characters (characters are received one by one), write a function that prints ‘Yes’ if a character makes the complete string palindrome,… 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 »

## Manacher’s Algorithm – Linear Time Longest Palindromic Substring – Part 4

In Manacher’s Algorithm Part 1 and Part 2, we gone through some of the basics, understood LPS length array and how to calculate it efficiently… Read More »

## Manacher’s Algorithm – Linear Time Longest Palindromic Substring – Part 3

In Manacher’s Algorithm Part 1 and Part 2, we gone through some of the basics, understood LPS length array and how to calculate it efficiently… Read More »