spoj 61. Brackets | BRCKTS | valgrind saved me

I don’t know what happens with me when it comes to the segment trees, i always fucked up with the tree size. the result is a stupid SIGSEGV.

So the rule of thumb when dealing with the segment tree problem is to be careful with it’s size. (pow(2, ceil(log2(n)) + 1))

and in these cases valgrind, gdb comes in great help to recognize where the memory leaks are occurring.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s