bera_674's blog

By bera_674, history, 39 hours ago, In English

Hello everyone, can anybody tell me how to find no of distinct elements of a range ?

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
38 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

You can do it with Mo's algorithm ,

»
38 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

Use Mo's Algorithm in $$$O(n \sqrt{n})$$$ or sweepline fenwick tree in $$$O(n \log n)$$$. There are probably a lot of tutorials on this since it's so classic.

»
38 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

this blog will help — blog

»
38 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

sweepline range sums best