Dynamic Programming

Dynamic Programming with proper indented code and example.
Covers following topics

1.Optimal Parenthesization of Matrix Chain Product
2.Least Common Subsequence
3.Optimal Binary Search Tree
4.0-1 Knapsack Problem
5.Binomial Coefficient Computation
6.Floyd-Warshall Algorithm

https://drive.google.com/open?id=0B6JEvMco0pOEUVBXNUdwQUdBMGc

APTITUDE PREPARATION-5

APTITUDE PREPARATION-5

SQUARE ROOTS AND CUBE ROOTS

IMPORTANT FACTS AND FORMULAE


Square Root: If x2 = y, we say that the square root of y is x and we write, √y = x.
Thus, √4 = 2, √9 = 3, √196 = 14.
Cube Root: The cube root of a given number x is the number whose cube is x. We denote the cube root of x by 3√x.
Thus, 3√8  = 3√2 x 2 x 2 = 2, 3√343 = 3√7 x 7 x 7 = 7 etc.
Note:
1.√xy = √x * √y                     2. √(x/y) = √x / √y  = (√x / √y) * (√y / √y) = √xy / y

SOLVED EXAMPLES


Ex. 1. Evaluate √6084 by factorization method .
Sol.     Method: Express the given number as the product of prime factors.          2    6084  
            Now, take the product of these prime factors choosing one out of              2    3042
            every pair of the same primes. This product gives the square root              3    1521  
            of the given number.                                                                                     3    507
Thus, resolving 6084 into prime factors, we get:                                        13   169
6084 = 22 x 32 x 132                                                                                                         13                \6084 = (2 x 3 x 13) = 78.       
                                                                     

Ex. 2. Find the square root of 1471369.                                                   
Sol.     Explanation: In the given number, mark off the digits              1  1471369 (1213
in pairs starting from the unit's digit. Each pair and                        1             
the remaining one digit is called a period.                                22     47
Now, 12 = 1. On subtracting, we get 0 as remainder.                        44
Now, bring down the next period i.e., 47.                               241      313
Now, trial divisor is 1 x 2 = 2 and trial dividend is 47.                       241
So, we take 22 as divisor and put 2 as quotient.                    2423        7269
The remainder is 3.                                                                                7269
Next, we bring down the next period which is 13.                                  x
Now, trial divisor is 12 x 2 = 24 and trial dividend is
313. So, we take 241 as dividend and 1 as quotient.
The remainder is 72. ­
Bring down the next period i.e., 69.
Now, the trial divisor is 121 x 2 = 242 and the trial
dividend is 7269. So, we take 3as quotient and 2423
as divisor. The remainder is then zero.
Hence, √1471369 = 1213.

Ex. 3. Evaluate: 248 + 51 + √ 169 .
Sol.     Given expression = 248 + √51 + 13 = 248 + √64    = √ 248 + 8 = √256 = 16.

Ex. 4. If a * b * c = √(a + 2)(b + 3) / (c + 1), find the value of 6 * 15 * 3.
Sol.      6 * 15 * 3 = √(6 + 2)(15 + 3) / (3 + 1) = √8 * 18 / 4 = √144 / 4 = 12 / 4 = 3.
Ex. 5. Find the value of √25/16.
Sol.    √ 25 / 16   = √ 25 / √ 16 = 5 / 4


Ex. 6. What is the square root of 0.0009?
Sol.      √0.0009= √ 9 / 1000  = 3 / 100 = 0.03.

Ex. 7. Evaluate √175.2976.
Sol.      Method: We make even number of decimal places              1   175.2976 (13.24  
by affixing a zero, if necessary. Now, we mark off                   1
periods and extract the square root as shown.                     23     75            
                                                                                                      69
\√175.2976 = 13.24                                                         262       629
                                                                                                                    524
                                                                                                     2644       10576
                                                                                                                    10576
                                                                                                                        x


Ex. 8. What will come in place of question mark in each of the following questions?
(i) √32.4 / ?  = 2                       (ii) √86.49 + √ 5 + ( ? )2 = 12.3.
            Sol.      (i) Let √32.4 / x = 2. Then, 32.4/x = 4 <=> 4x = 32.4 <=> x = 8.1.
                     
(ii) Let √86.49 + √5 + x2 = 12.3.
      Then, 9.3 + √5+x2 = 12.3 <=> √5+x= 12.3 - 9.3 = 3
      <=> 5 + x2 = 9   <=> x2 = 9 - 5= 4   <=>   x = √4 = 2.


Ex.9. Find the value of √ 0.289 / 0.00121.
 


Sol.      √0.289 / 0.00121 = √0.28900/0.00121 = √28900/121 = 170 / 11.

 


Ex.10. If √1 + (x / 144) = 13 / 12, the find the value of x.

Sol.      √1 + (x / 144) = 13 / 12 Þ ( 1 + (x / 144)) = (13 / 12 )2 = 169 / 144
  Þx / 144 = (169 / 144) - 1
  Þx / 144 = 25/144 Þ x = 25.

Ex. 11. Find the value of √3 up to three places of decimal.
Sol.                
  1    3.000000   (1.732
                                1
27    200
189
                      343      1100
                                  1029
                    3462          7100
6924                          \√3 = 1.732.



Ex. 12. If √3 = 1.732, find the value of √192 - 1 √48 - √75 correct to 3 places
                                                                            2                        
of decimal.                                                                                     (S.S.C. 2004)
Sol.     192 - (1 / 2)√48 - √75 = √64 * 3 - (1/2) √ 16 * 3  - √ 25 * 3
                                                =8√3 - (1/2) * 4√3 - 5√3
                                                =3√3 - 2√3 = √3 = 1.732
 


Ex. 13. Evaluate: √(9.5 * 0.0085 * 18.9) / (0.0017 * 1.9 * 0.021)
Sol.      Given exp. = √(9.5 * 0.0085 * 18.9) / (0.0017 * 1.9 * 0.021)
            Now, since the sum of decimal places in the numerator and denominator under the            radical sign is the same, we remove the decimal.
\        Given exp = √(95 * 85 * 18900) / (17 * 19 * 21) = √ 5 * 5 * 900  = 5 * 30 = 150.

Ex. 14. Simplify: √ [( 12.1 )2 - (8.1)2] / [(0.25)2 + (0.25)(19.95)]
Sol.      Given exp. = √ [(12.1 + 8.1)(12.1 - 8.1)] / [(0.25)(0.25 + 19.95)]
                       
                              =√ (20.2 * 4) /( 0.25 * 20.2)   = √ 4 / 0.25 = √400 / 25 = √16 = 4.
Ex. 15. If x = 1 + √2 and y = 1 - √2, find the value of (x2 + y2).
Sol.      x2 + y2 = (1 + √2)2 + (1 - √2)2 = 2[(1)2 + (√2)2] = 2 * 3 = 6.

Ex. 16. Evaluate: √0.9 up to 3 places of decimal.
Sol.                 
9    0.900000(0.948
         81
184         900
736
                  1888         16400
                                   15104                             \√0.9 = 0.948
                         

Ex.17. If √15 = 3.88, find the value of √ (5/3).
Sol.      √ (5/3) = √(5 * 3) / (3 * 3)  = √15 / 3 = 3.88 / 3 = 1.2933…. = 1.293.
    
Ex. 18. Find the least square number which is exactly divisible by 10,12,15 and 18.
Sol.      L.C.M. of 10, 12, 15, 18 = 180. Now, 180 = 2 * 2 * 3 * 3 *5 = 22 * 32 * 5.
            To make it a perfect square, it must be multiplied by 5.
\         Required number = (22 * 32 * 52) = 900.

Ex. 19. Find the greatest number of five digits which is a perfect square.
(R.R.B. 1998)
Sol.      Greatest number of 5 digits is 99999.
                                                    3    99999(316
      9 
                                                  61      99
                                                            61
626      3899
           3756
                                                             143
\                  Required number == (99999 - 143) = 99856.

Ex. 20. Find the smallest number that must be added to 1780 to make it a perfect
square.
Sol.
                                    4    1780 (42
                                          16
82      180         
164
            16
 


      \               Number to be added = (43)2 - 1780 = 1849 - 1780 = 69.

Ex. 21. √2 = 1.4142, find the value of √2 / (2 + √2).
Sol.      √2 / (2 + √2) = √2 / (2 + √2) * (2 - √2) / (2 - √2) = (2√2 – 2) / (4 – 2)
                                 = 2(√2 – 1) / 2 = √2 – 1 = 0.4142.


22. If x = (√5 + √3) / (√5 - √3) and y = (√5 - √3) / (√5 + √3), find the value of (x+ y2).
Sol.     
x = [(√5 + √3) / (√5 - √3)] * [(√5 + √3) / (√5 + √3)] = (√5 + √3)2 / (5 - 3)
   =(5 + 3 + 2√15) / 2 = 4 + √15.        
            y = [(√5 - √3) / (√5 + √3)] * [(√5 - √3) / (√5 - √3)] = (√5 - √3)2 / (5 - 3)
               =(5 + 3 - 2√15) / 2 = 4 - √15.
\         x2 + y2 = (4 + √15)2 + (4 - √15)2 = 2[(4)2 + (√15)2] = 2 * 31 = 62.


Ex. 23. Find the cube root of 2744.
Sol.    Method: Resolve the given number as the product                 2    2744
          of prime factors and take the product of prime                        2    1372
           factors, choosing one out of three of the same                        2      686         
           prime factors. Resolving 2744 as the product of                     7      343
           prime factors, we get:                                                              7  ­      49
                                                                                                                       7
           2744 = 23 x 73.                                                                            
\      3√2744= 2 x 7 = 14.

                                                                                                    
Ex. 24. By what least number 4320 be multiplied to obtain a number which is a perfect cube?
Sol.      Clearly, 4320 = 23 * 33 * 22 * 5.

            To make it a perfect cube, it must be multiplied by 2 * 52 i.e,50.
Powered by Blogger.

Popular Posts