segment tree

Revision en1, by vsanjay_nitdgp, 2015-08-15 13:04:42

i used the following lazy propogation to update my tree...like i wanted to get sum of [i,j]

http://ideone.com/L8GQjo

my input was n=8;all elements set to zero.'0'.

then i gave my array number 26 to update array from i=1 to i=3;[1,3]

but i am getting tree[1]=52 instead of 78....

could any one say where i am getting wrong.....

thanks in advance

Tags data structure, segment tree, #trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English vsanjay_nitdgp 2015-08-15 13:20:08 12 Tiny change: 'deone.com/L8GQjo\n\n\nmy i' -> 'deone.com/Vh05zS\n\n\nmy i'
en1 English vsanjay_nitdgp 2015-08-15 13:04:42 378 Initial revision (published)