For practising segment trees I was trying the GSS1 problem of SPOJ. When I ran my code on SPOJ it failed on the 9th test case. After some debugging, i came up with test case 6 1 2 80 79 -90 -8 1 1 6
But results got worse *** glibc detected *** demo: free(): invalid next size (fast): 0x0000000002371510 ***
Can someone help me out with this error?
http://pastebin.com/6NSwEHHz Here is my code. Any help will be much appreciated.