## Self Organizing List | Set 1 (Introduction)

The worst case search time for a sorted linked list is O(n). With a Balanced Binary Search Tree, we can skip almost half of the… Read More »

- Remove minimum elements from either side such that 2*min becomes more than max | Set 2
- Count of words that are present in all the given sentences
- Design a Chess Game
- 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
- Lazy Propagation in Segment Tree | Set 2
- Longest string in an array which matches with prefix of the given string
- Persistent Trie | Set 1 (Introduction)
- Rearrange numbers in an array such that no two adjacent numbers are same
- Range Queries to Find number of sub-arrays with a given xor
- Program to implement Run Length Encoding using Linked Lists
- Introduction to R-tree
- Sort an array of strings based on the frequency of good words in them
- Queries to update a given index and find gcd in range
- Find triplet such that number of nodes connecting these triplets is maximum
- Find the number of different numbers in the array after applying the given operation q times
- Find a pair from the given array with maximum nCr value
- Flipping Sign Problem | Lazy Propagation Segment Tree
- B-Tree Insert without aggressive splitting
- 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
- Strings from an array which are not prefix of any other string
- Gap Buffer Data Structure
- Check if the given Trie contains words starting from every alphabet
- Implement a Dictionary using Trie
- Insertion in a Trie recursively

The worst case search time for a sorted linked list is O(n). With a Balanced Binary Search Tree, we can skip almost half of the… Read More »

It is recommended to refer following posts as prerequisite of this post. B-Tree | Set 1 (Introduction) B-Tree | Set 2 (Insert) B-Tree is a… Read More »

Consider a coding system for alphabets to integers where ‘a’ is represented as 1, ‘b’ as 2, .. ‘z’ as 26. Given an array of… Read More »

Given a dictionary of words and an input string, find the longest prefix of the string which is also a word in dictionary. Examples: Let… Read More »

In the previous post, we introduced B-Tree. We also discussed search() and traverse() functions. In this post, insert() operation is discussed. A new key is… Read More »

B-Tree is a self-balancing search tree. In most of the other self-balancing search trees (like AVL and Red-Black Trees), it is assumed that everything is… Read More »

Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity,… Read More »

Can we search in a sorted linked list in better than O(n) time? The worst case search time for a sorted linked list is O(n)… Read More »

Design a Data Structure for the following operations. The data structure should be efficient enough to accommodate the operations according to their frequency. 1) findMin()… Read More »

We have introduced segment tree with a simple example in the previous post. In this post, Range Minimum Query problem is discussed as another example… Read More »

Let us consider the following problem to understand Segment Trees. We have an array arr[0 . . . n-1]. We should be able to 1… Read More »

A ternary search tree is a special trie data structure where the child nodes of a standard trie are ordered as a binary search tree.… Read More »

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 »