# Tag Archives: Binary Indexed Tree

A compressed 2D Binary Indexed Tree (BIT) is a data structure that is used to efficiently store and query two-dimensional arrays, particularly when the values… Read More
Binary Indexed Tree (BIT), also known as Fenwick Tree, is a data structure used for efficiently querying and updating cumulative frequency tables, or prefix sums. … 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 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 other words output… Read More