Online approach for range inversion count?

Revision en1, by FruitLoop, 2015-09-27 07:42:49

Given an array A of n integers. M queries are given in the form of l, r. For each query, I need to count the number of inversions in subarray A from l to r. I know the offline approach to solve this using BIT and sqrt decomposition.

Is it possible to solve this problem online using segment tree or any other data structure?

Tags segment tree, fenwick tree, data structures, inversions

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English FruitLoop 2015-09-27 07:42:49 371 Initial revision (published)