Persistent Segment Tree Help Needed.

Revision en1, by binary_eagle, 2016-02-24 00:00:40

Hi Codeforces Community,

I recently learnt about segment trees and enjoyed it a lot. Right now, I am trying to solve a problem http://www.spoj.com/problems/MKTHNUM/.

The approach I used was to build the segment tree but maintain a sorted array at each segment. Afterwards, for each query [L, R], I got all the disjoint segments that form [L, R] and merged them recursively in order to answer query. I realize that there is a faster way to answer each query in lgn, (lgn)^2 times. I also think it is related with persistent segment tree.

I have tried to access Anudeep's tutorial on it but it is not loading. Please can someone help with an example or idea of how Persistent segment trees work?

Thank you.

Tags trees, segment trees, persistent segment trees, query

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English binary_eagle 2016-02-24 00:00:40 767 Initial revision (published)