Hey , i was learning persistent segment trees , i got what the concept behind it and now i have to solve problems.I guess people out here might be having some built in templates , can you share yours so that i can see how to efficiently code it as i read that too much pointers can cause TLE.
HOW TO UPDATE RANGES USING LAZY PROPAGATION IN THIS METHOD
But you shouldn't be having any problems with pointers since you're "javacoder" right? :P
And check this link for a tutorial and with sample code too.
Hi, Here an interesting problem : E. The Classic Problem and my solution
i think if you explored the accepted codes you will find what you need.
Thanks , i will definitely look into it.If you have codes using this data structure of perhaps an easy question can you please share?
Can you help me in the range updates part?
Auto comment: topic has been updated by javacoder1 (previous revision, new revision, compare).
I use the code posted here , it doesn't use pointers
Does someone have a max/min template for 2D fenwick?
If it is possible?
I have for one dimensional case, though I don't really understand it but it is fast :D .Link
Actually too much pointers wont cause TLE, but dynamic allocation would. You can use pointers with static pool of nodes. Here is code for this problem
YOUR SHIFT SEEMS TO BE STUCK
Shift and comment fixed
Can someone suggest me more questions prefably on codeforces solved using this method which has not been mentioned?
My solution for DQUERY.
Can you please help referring to my comment below?
How to handle range updates in persistent segment trees. Point updates for a particular query means that we have to change only log(n) nodes in path from root to leaf so for q queries space complexity would be n+qlog(n) but for the case of range updates i would keep a lazy value at each node but the problem i am facing is that the node to be updated would be representing some range so to change it would mean recreating the whole structure beneath it which be be too much costly considering the fact that there might be more range updates in the queries.Can someone suggest how to implement this?
PLease help me , i am stuck
Can someone explain how to update ranges in a persistent segment tree?
After the competition is over, sure :D
I think this can be googled. But I haven't actually seen an implementation of it myself.
I have one for you. This is a solution of problem HORRIBLE of SPOJ which uses lazy propagation and persistent segment tree.
Thank you !