Microsoft Interview Question
Program ManagersDraw a square. Color half of the square. Out of the remaining half, again color the remaining half.. Repeat and show that what is left uncolored gets reduced to its half so the totally uncolored depends on how many times we color it. since we go on to infinity it will be zero. If he/she argues that there will always be some uncolored portion left, tell him/her that that will be case only when you stop doing this exercise...which will be NEVER as you want to do it till infinity.
I think this series is also useful in calculating the floating point mantissa.
I know then we need to insert certain 0's
but in case we have the mantissa as 1111111111111111111111
then the value of mantissa would form the same series while converted to decimal
1* 1/2 + 1* 1/4...
ans as we know as this-> infinite the mantissa -> 1 (.999999999999999999999999)
oops, generalize series and using limit,
- Zaphod May 10, 2010Sn = { 1/2 + 1/4 + 1/8 + ... + 1/(2^n) }
2Sn = { 1 + 1/2 + 1/4 ... + 1/(2^(n-1)) }
2Sn - Sn = { 1 + (1/2-1/2) + (1/4-1/4) + ... (1/2^(n-1) - 1/2^(n-1)) - 1/(2^n) }
= 1 - 1/(2^n)
lim n-> inf Sn = 1 - 1/(2^n)
= 1