Why Segment Tree here is fast?

Revision en2, by Ehsan_sShuvo, 2017-09-26 19:09:25

Here is two implementation of this problem

Using Sparse Table: Submission Using Segment Tree: Submission

Time took by Sparse Table is 0.336 s ,where Segment Tree took 0.324 s. Memory took by Sparse Table is 8732 KB ,where Segment Tree took 3640 KB.

Problem is static,thats why Sparse Table should be fast!But here i couldn't see this..Where is the problem?Could anyone please find that out ?

Thanks in advance :)

Tags sparse table, segment tree, light oj

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Ehsan_sShuvo 2017-09-26 19:09:25 8
en1 English Ehsan_sShuvo 2017-09-26 19:08:29 592 Initial revision (published)