# Tag Archives: Binary Indexed Tree

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
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
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
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
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
Given an array A[], for each element in the array, the task is to find the sum of all the previous elements which are strictly… Read More
Given an array A[] of integers and array Q consisting of queries of the following two types: (1, L, R) : Return XOR of all… Read More
Given a rooted tree (assume root is 1) of N nodes and Q queries, each of the form (Val, Node). For each query, the task… Read More
Given an array arr[] of size N. The task is to find smaller elements on the right side and greater elements on the left side… Read More
Given a tree of N nodes and an integer K, each node is numbered between 1 and N. The task is to find the number… Read More
Given an array A of N integers and number of queries Q. You have to answer two types of queries.   Update [l, r] – for… Read More
Prerequisites: Fenwick Tree (Binary Indexed Tree)Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r and… Read More
Given an array of n distinct integers and an integer k. Find out the number of sub-sequences of a such that , and . In… Read More
Given an array of numbers of size N and Q queries. Each query or a range can be represented by L (LeftIndex) and R(RightIndex). Find… Read More
Given an array A of N integers. You have to answer two types of queries : 1. Update [l, r] – for every i in… Read More