Slideshow

Sunday, 24 February 2013


Q.273 Suppose we wish to partition the square roots of the integers from 1 to 100 in to
two piles of fifty numbers each, such that the sum of the numbers in the first pile
is as close as possible to the sum of the numbers in the second pile. If you could
use minimum computer time to answer this question, what computations would
you perform on the computer in that time? (5)
Ans :


According to question, sum of square roots in two piles should be as close as
possible. For that we can add square roots of odd numbers. In one pile and square
roots of even numbers in another pile. Since for natural numbers also if we want to
divide into two piles according to nearest equal sum requirement above solution
will work i.e.1+3+………………….+99, 2+4+ …………..+100.Square root is a
strictly increasing function for positive numbers. So result holds for square root
also.
Computations
1. Check whether no. is odd or even dividing by two, module is zero or not.
2. Add the variable sum computation time for n nos. It will require
(n) time.

No comments:

Post a Comment