## Count Inversions of size three in a given array

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 »

- Design a Chess Game
- Kth smallest element in a subarray
- Implement a Dictionary using Trie
- Rearrange numbers in an array such that no two adjacent numbers are same
- Trie Data Structure using smart pointer and OOP in C++
- Count smaller elements on right side and greater elements on left side using Binary Index Tree
- Sort an array of strings based on the frequency of good words in them
- Longest string in an array which matches with prefix of the given string
- Queries for number of distinct elements in a subarray | Set 2
- Flipping Sign Problem | Lazy Propagation Segment Tree
- Search in a trie Recursively
- Extendible Hashing (Dynamic approach to DBMS)
- Bottom-up traversal of a Trie
- Gap Buffer Data Structure
- Count inversions in an array | Set 4 ( Using Trie )
- String Range Queries to find the number of subsets equal to a given String
- B*-Trees implementation in C++
- Insertion in a Trie recursively
- Shortest cycle in an undirected unweighted graph
- Van Emde Boas Tree | Set 1 | Basics and Construction
- Strings from an array which are not prefix of any other string
- Maximise the number of toys that can be purchased with amount K using min Heap
- Number of triplets in array having subarray xor equal
- Proto Van Emde Boas Tree | Set 2 | Construction
- Van Emde Boas Tree | Set 2 | Insertion, Find, Minimum and Maximum Queries
- Check if the given Trie contains words starting from every alphabet
- Lexicographical ordering using Heap Sort
- Pairing Heap
- Range maximum query using Sparse Table
- Proto Van Emde Boas Tree | Set 3 | Insertion and isMember Query

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 »

Heaps are mainly used for implementing priority queue. We have discussed below heaps in previous posts. Binary Heap Binomial Heap In terms of Time Complexity,… Read More »

We strongly recommend to refer below posts as a prerequisite of this. K Dimensional Tree | Set 1 (Search and Insert) K Dimensional Tree |… Read More »

We strongly recommend to refer below post as a prerequisite of this. K Dimensional Tree | Set 1 (Search and Insert) In this post find… Read More »

Segment tree is introduced in previous post with an example of range sum problem. We have used the same “Sum of given Range” problem to… Read More »

How to design a system that takes big URLs like “https://www.geeksforgeeks.org/count-sum-of-digits-in-numbers-from-1-to-n/” and converts them into a short 6 character URL. It is given that URLs… Read More »

Design a data structure that supports the following operations in Θ(1) time. insert(x): Inserts an item x to the data structure if not already present.… Read More »

Unlike C++ and Java, C doesn’t support generics. How to create a linked list in C that can be used for any data type? In… Read More »