##
Segment Tree | Set 3 (XOR of given range)
June 14, 2017

We have an array arr[0 . . . n-1]. There are two type of queries Find the XOR of elements from index l to r… Read More »

June 14, 2017

We have an array arr[0 . . . n-1]. There are two type of queries Find the XOR of elements from index l to r… Read More »

Given an array where each element is a vector containing integers in sorted order. The task is to answer following queries: count(start, end, k) :… Read More »

May 28, 2017

We are given 2*N – 1 integers. We need to check whether it is possible to construct a Range Minimum Query segment tree for an… Read More »

February 10, 2017

Prerequisite : Segment Tree Persistency in Data Structure Segment Tree is itself a great data structure that comes into play in many cases. In this… Read More »

November 4, 2016

Given Q queries, of type: L R, for each query you must print the maximum number of divisors that a number x (L <= x… Read More »

October 4, 2016

ACM ICPC(Association for Computing Machinery – International Collegiate Programming Contest) is a world-wide annual multi-tiered programming contest being organized for over thirteen years. The contest… Read More »

October 1, 2016

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 »

September 11, 2016

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 »

July 26, 2016

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 »

July 24, 2016

Prerequisites : LCE(Set 1), LCE(Set 2), Suffix Array (n Log Log n), Kasai’s algorithm and Segment Tree The Longest Common Extension (LCE) problem considers a… Read More »

July 1, 2016

Given an empty set initially and a number of queries on it, each possibly of the following types: Insert – Insert a new element ‘x’.… Read More »

June 13, 2016

Given an array arr[] of n numbers and an integer k, find length of the minimum sub-array with gcd equals to k. Example: Input: arr[]… Read More »

June 9, 2016

Given an array a[0 . . . n-1]. We should be able to efficiently find the GCD from index qs (query start) to qe (query… 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 »