## Pattern Searching using Suffix Tree

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… Read More »

- Sort the array of strings according to alphabetical order defined by another string
- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Number of subarrays have bitwise OR >= K
- Count of words that are present in all the given sentences
- Range Sum Queries and Update with Square Root
- Count pairs (A, B) such that A has X and B has Y number of set bits and A+B = C
- Given an array and two integers l and r, find the kth largest element in the range [l, r]
- Count of strings whose prefix match with the given string to a given length k
- Range and Update Sum Queries with Factorial
- Range Queries to Find number of sub-arrays with a given xor
- Lazy Propagation in Segment Tree | Set 2
- Program to implement Run Length Encoding using Linked Lists
- Persistent Trie | Set 1 (Introduction)
- Queries for Composite numbers in subarray (With Point Updates)
- Find a pair from the given array with maximum nCr value
- Find triplet such that number of nodes connecting these triplets is maximum
- Queries to update a given index and find gcd in range
- B-Tree Insert without aggressive splitting
- Introduction to R-tree
- Arrange array elements such that last digit of an element is equal to first digit of the next element
- Index of kth set bit in a binary array with update queries
- Find the number of different numbers in the array after applying the given operation q times

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… Read More »

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… Read More »

Given a binary matrix, print all unique rows of the given matrix. Example: Input: {0, 1, 0, 0, 1} {1, 0, 1, 1, 0} {0,… Read More »

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… Read More »

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… Read More »

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… Read More »

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

We have discussed AVL insertion in the previous post. In this post, we will follow a similar approach for deletion. Steps to follow for deletion.… Read More »

AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for… Read More »

In the previous post on trie we have described how to insert and search a node in trie. Here is an algorithm how to delete… Read More »

Trie is an efficient information reTrieval data structure. Using Trie, search complexities can be brought to optimal limit (key length). If we store keys in… Read More »

Let us solve the classic “fake coin” puzzle using decision trees. There are the two different variants of the puzzle given below. I am providing… Read More »

Spaghetti stack A spaghetti stack is an N-ary tree data structure in which child nodes have pointers to the parent nodes (but not vice-versa) Spaghetti… Read More »

An ordinary Doubly Linked List requires space for two address fields to store the addresses of previous and next nodes. A memory efficient version of… Read More »

Given a team of N players. How many minimum games are required to find second best player? We can use adversary arguments based on tournament… Read More »