# Tag Archives: Binary Indexed Tree

## How to prepare for ACM – ICPC?

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 »

## Binary Indexed Tree : Range Updates and Point Queries

Given an array arr[0..n-1]. The following operations need to be performed. update(l, r, val) : Add ‘val’ to all the elements in the array from… Read More »

## Finding the number of triangles amongst horizontal and vertical line segments

Prerequisites: BIT Given ‘n’ line segments, each of them is either horizontal or vertical, find the maximum number of triangles(including triangles with zero area) that… Read More »

## Querying the number of distinct colors in a subtree of a colored tree using BIT

Prerequisites : BIT, DFS Given a rooted tree T, with ‘n’ nodes, each node has a color denoted by the array color[](color[i] denotes the color… Read More »

## Two Dimensional Binary Indexed Tree or Fenwick Tree

Prerequisite – Fenwick Tree We know that to answer range sum queries on a 1-D array efficiently, binary indexed tree (or Fenwick Tree) is the… Read More »

## Counting Triangles in a Rectangular space using BIT

Pre-requisite : BIT(Binary Indexed Tree or Fenwick Tree), 2D BIT Given a 2D plane, respond to Q queries, each of the following type: Insert x… Read More »

## Count Inversions of size three in a given array

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 »

## Count inversions in an array | Set 3 (Using BIT)

Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted then inversion… Read More »

## Top 10 Algorithms and Data Structures for Competitive Programming

In this post “Important top 10 algorithms and data structures for competitive coding “. Topics : Graph algorithms Dynamic programming Searching and Sorting: Number theory… Read More »

## Binary Indexed Tree or Fenwick Tree

Let us consider the following problem to understand Binary Indexed Tree. We have an array arr[0 . . . n-1]. We would like to 1… Read More »