##
Centroid Decomposition of Tree
March 15, 2016

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 »

March 15, 2016

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 »

March 7, 2016

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 »

February 23, 2016

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 »

February 14, 2016

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 »

January 17, 2016

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 »

January 10, 2016

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 »

December 21, 2015

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 »

December 18, 2015

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 »

December 15, 2015

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 »

December 5, 2015

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 »

October 31, 2015

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 »

October 22, 2015

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 »

October 14, 2015

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 »

October 8, 2015

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 »