## 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 »

- Shortest Path Faster Algorithm
- Count the number of words with given prefix using Trie
- Check if given words are present in a string
- How Coronavirus outbreak can end | Visualize using Data structures
- Minimum cost of reducing Array by merging any adjacent elements repetitively
- Design a data structure that supports insert, delete, getRandom in O(1) with duplicates
- Design a Queue data structure to get minimum or maximum in O(1) time
- Difference between B tree and B+ tree
- Median of sliding window in an array | Set 2
- Finding shortest path between any two nodes using Floyd Warshall Algorithm
- Queries for elements having values within the range A to B in the given index range using Segment Tree
- Ackermann Function
- Paranthesis Theorem
- XOR of elements in a given range with updates using Fenwick Tree
- Types of Tries
- Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
- Sum of prime numbers in range [L, R] from given Array for Q queries
- Maximum CPU Load from the given list of jobs
- Queries to check if any non-repeating element exists within range [L, R] of an Array
- Proof that traveling salesman problem is NP Hard
- Lexicographical smallest number after at most K consecutive swaps
- Sum and Maximum of elements in array from [L, R] before and after updates
- Range Sum and Update in Array : Segment Tree using Stack
- Query to find the maximum and minimum weight between two nodes in the given tree using LCA.
- Find K-th smallest element in an array for multiple queries
- Counting Inversions using Ordered Set and GNU C++ PBDS
- Static and Dynamic data structures in Java with Examples
- Check if a Tree can be split into K equal connected components
- Count of Array elements greater than all elements on its left and at least K elements on its right
- Count of elements in an Array whose set bits are in a multiple of K

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 »