Skip to content

Tag Archives: Segment-Tree

What is Segment Tree? A Segment Tree is a data structure that stores information about a range of elements in its nodes. It also allows… Read More
First, let us understand why we need it prior to landing on the introduction so as to get why this concept was introduced. Suppose we… Read More
Given an array consisting of N positive integers, and Q queries where each query is one of the following types: 1 l r – Requires… Read More
Given an array arr[ ] which contains N positive integers and an integer K and a vector of queries Q . Two types of queries… Read More
Given an array A[] of length N, where N is an even number, the task is to answer Q independent queries where each query consists… Read More
Given an array arr[] of size N where each element denotes a pair in the form (price, weight) denoting the price and weight of each… Read More
Given an array arr, the task is to replace each array element by the maximum of K next and K previous elements. Example: Input: arr[]… 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
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
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
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
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

Start Your Coding Journey Now!