## Count inversion pairs in a matrix

Given a matrix A of size NxN, we need to find the number of inversion pairs in it. Inversion count in a matrix is defined… 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
- Lexicographical smallest number after at most K consecutive swaps
- Proof that traveling salesman problem is NP Hard
- Range Sum and Update in Array : Segment Tree using Stack
- Sum and Maximum of elements in array from [L, R] before and after updates
- 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
- Count of Array elements greater than all elements on its left and at least K elements on its right
- Check if a Tree can be split into K equal connected components
- Queries to find the Minimum Weight from a Subtree of atmost D-distant Nodes from Node X

Given a matrix A of size NxN, we need to find the number of inversion pairs in it. Inversion count in a matrix is defined… Read More »

Given an array of integers, find the minimum (or maximum) element and the element just greater (or smaller) than that in less than 2n comparisons.… Read More »

Given a string of length n of lowercase alphabet characters, we need to count total number of distinct substrings of this string. Examples: Input :… Read More »

Given a matrix of size M x N, there are large number of queries to find submatrix sums. Inputs to queries are left top and… Read More »

Like array and linked list, unrolled Linked List is also a linear data structure and is a variant of linked list. Unlike simple linked list,… Read More »

Let us consider the below problem statement and think of different solutions for it. Given a set S of elements such that the elements are… Read More »

Given a list of contacts which exist in a phone directory. The task is to implement search query for the phone directory. The search query… Read More »

Given an array arr[0..n-1]. The following operations need to be performed. update(l, r, val) : Add ‘val’ to all the elements in the array from… Read More »

Given a size n in which initially all elements are 0. The task is to perform multiple multiple queries of following two types. The queries… Read More »

Given an array arr[0 . . . n-1]. We need to efficiently find the minimum and maximum value from index qs (query start) to qe… Read More »

Given a dictionary of words where each word follows CamelCase notation, print all words in the dictionary that match with a given pattern consisting of… Read More »

Given an array of integers, evaluate queries of the form LCM(l, r). There might be many queries, hence evaluate the queries efficiently. LCM (l, r)… Read More »

Prerequisites : BIT, DFS Given a rooted tree T, with ‘n’ nodes, each node has a color denoted by the array color[](color[i] denotes the color… Read More »

Prerequisites : Suffix Array | Set 2 kasai’s algorithm The Longest Common Extension (LCE) problem considers a string s and computes, for each pair (L… Read More »