How to solve this problem using segment tree?

Revision en2, by WhitePaper, 2017-09-19 08:51:42

You are given an array of n integers. Using segment tree how can you find for each number how many numbers are smaller than this are exist before that number. For example:

input: (first number is the value of n) 5 1 4 2 5 3

output: 0 1 1 3 2

Tags segment tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English WhitePaper 2017-09-19 08:51:42 3
en1 English WhitePaper 2017-09-19 08:50:42 293 Initial revision (published)