## Persistent data structures

All the data structures discussed here so far are non-persistent (or ephermal). A persistent data structure is a data structure that always preserves the previous… Read More »

- 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
- Count of strings whose prefix match with the given string to a given length k
- Given an array and two integers l and r, find the kth largest element in the range [l, r]
- 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)
- Range Queries to Find number of sub-arrays with a given xor
- Program to implement Run Length Encoding using Linked Lists
- Rearrange numbers in an array such that no two adjacent numbers are same
- Introduction to R-tree
- Find a pair from the given array with maximum nCr value
- Queries for Composite numbers in subarray (With Point Updates)
- 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
- 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

All the data structures discussed here so far are non-persistent (or ephermal). A persistent data structure is a data structure that always preserves the previous… Read More »

Background : What is centroid of Tree? Centroid of a Tree is a node which if removed from the tree would split it into a… Read More »

Background : In a flow network, an s-t cut is a cut that requires the source ‘s’ and the sink ‘t’ to be in different… Read More »

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 »

We have discussed below data structures in previous two sets. Set 1 : Overview of Array, Linked List, Queue and Stack. Set 2 : Overview… Read More »

We strongly recommend to refer below post as a prerequisite of this. Heavy Light Decomposition | Set 1 (Introduction) In the above post, we discussed… Read More »

Heavy Light decomposition (HLD) is one of the most used techniques in competitive programming. Example Problem: Let us understand Heavy-light decomposition (HLD) with the help… Read More »

Given an array arr[] of size n. Three elements arr[i], arr[j] and arr[k] form an inversion of size 3 if a[i] > a[j] >a[k] and… Read More »

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »

The article describes an approach to solving the problem of finding the LCA of two nodes in a tree by reducing it to a RMQ… Read More »

We have an array arr[0 . . . n-1]. We should be able to efficiently find the minimum value from index L (query start) to… Read More »

Given an array of integers. find the maximum XOR subarray value in given array. Expected time complexity O(n). Examples: Input: arr[] = {1, 2, 3,… Read More »

We strongly recommend to refer set 1 as a prerequisite of this post. Treap (A Randomized Binary Search Tree) In this post, implementations of search,… Read More »

Like Red-Black and AVL Trees, Treap is a Balanced Binary Search Tree, but not guaranteed to have height as O(Log n). The idea is to… Read More »

Given an array of words, find all shortest unique prefixes to represent each word in the given array. Assume that no word is prefix of… Read More »