# Binary Indexed Tree

Previous week, we saw how we can use Square root decomposition to solve our problem. This week, we will see how we can solve the same problem by using a different technique called Binary Indexed Tree (also called Fenwick Tree). Binary Indexed tree is a useful technique when we are dealing with a dynamic array of data where following type of ... Read more

# Square Root Decomposition

Let’s consider the Problem Statement from HackerEarth. Basically, you are given an array $$A$$ of size $$N$$ and $$Q$$ queries. Each query can be of two types - $$1$$ $$i$$ - add $$1$$ to the $$i^{th}$$ element of the array $$A$$ $$2$$ $$K$$ - print the $$K^{th}$$ odd number of the array $$A$$ if it exists, else print $$-1$$ And all t... Read more

# Python & Terminal

(Note: All of these is related to Python 2. Python 3 may show different results.) While doing some office work, I came across this. I had written below line in my Python 2 interpreter. >>> s = '©' >>> s #for checking the value of s Surprisingly, I got the following value. '\xc2\xa9' The reason I was surprised,... Read more

# Life of a binary

Almost every one of you must have written a program, compiled it and then ran it to see the fruits of your hard labour. It feels good to finally see your program working, isn’t it? But to make all of this work, we have someone else to thankful too. And that is your compiler (of course, assuming that you are working in a compiled language, not an... Read more