Page 35 - DCAP407_DATA_STRUCTURE
P. 35

Data Structure



                          A logarithm is an exponent. The logarithmic function is defined as f(x)= log b   x. Here, the base of the
                          algorithm is b. The two most common bases which we use are base 10 and base e


                                             Consider the exponential equation 5 =25 where 5 is base and 2 is exponent.
                                                                          2
                                             The logarithmic form of this equation is:
                                             log 525=2
                          Here, we can say that the logarithm of 25 to the base 5 is 2.
                          Factorial

                          The symbol of the factorial function is ‘!’. The factorial function multiplies a series of natural numbers
                          that are in descending order. The factorial of a positive integer n which is denoted by n! represents the
                          product of all the positive integers is less than or equal to n.
                                                          n!=n*(n-1)*(n-2)……2*1



                                          5!=5*4*3*2*1=120

                          Fibonacci Numbers
                          In the Fibonacci sequence, after the first two numbers i.e.  0 and 1 in the sequence, each subsequent
                          number in the series is equal to the sum of the previous two numbers. The sequence is named after
                          Leonardo of Pisa, also known as Fibonacci.
                          Fibonacci numbers are the elements of Fibonacci sequence:
                          1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765…….

                          Sometimes this sequence is given as 0, 1, 1, 2, 3, 5….. There are also other Fibonacci sequences which
                          start with the numbers:
                          3, 10, 13, 23, 36, 59…….
                          Fibonacci numbers are the example of patterns that have intrigued mathematicians through the ages. In
                          mathematical terms, the sequence F n of  Fibonacci numbers is defined as:
                                                              F n = F n-1+ F n-2


                                              Beginning with a single pair of rabbits, if every month each productive pair
                                              bears a new pair,  who become productive when they are 1 month old, how
                                              many rabbits will there be after n months?
                                              Assume that there are x  pairs of rabbits after n months. The number of pairs
                                                                 n
                                              in n+1 month is x n+1 . Each pair produces a new pair every month but no
                                              rabbit dies within that period. New pairs are only born to pairs which are at
                                              least 1 month old, so there is an x  new pair.
                                                                        n-1
                                              X n+1  = x  + x
                                                    n
                                                       n-1
                                              This equation shows the rules for generating the Fibonacci numbers.




                          Did you know?   Fibonacci was the greatest mathematician of his age. He eliminated the use of complex
                                        Roman numerals and made mathematics more accessible to the public by bringing the
                                        Hindu-Arabic system (including zero) to Western Europe.
                          Modular Arithmetic

                          Modular arithmetic is a system of arithmetic for integers.  In the modular  arithmetic,  numbers wrap
                          around and reach a given fixed quantity, which is known as the modulus. This is 12 in the case of hours
                          and 60 in the case of minutes or seconds in a clock. In the 12 hour clock, the day is divided into two 12



                          28                      LOVELY PROFESSIONAL UNIVERSITY
   30   31   32   33   34   35   36   37   38   39   40