Monday, March 25, 2019

T(n) = 2 T(n/4) + √n | Master Theorem | Master Method | time complexity for recurrence

                                 

                                   T(n)  = 2 T(n/4) + √n      eq.1


we solve it by Master Method

step1 . compute nlogba
                        here we compare eq.1 with T(n) = aT(n/b) + f(n)
          
                        a = 2 ,b=4 , f(n) = n
                       
                       nlogba   à  nlog42   à n

step2.  we compare  function f(n)  to nlogba  
               here from eq.1 
              f(n) = n
            nlogba  = n
i.e   f(n)  and  nlogba  are equal

f(n) = θ nlogba)

so case 2 of Master Method is applied 

step3.  Time complexity for case 2 is  
T(n) =  θ (nlogba .logn)
T(n) = θ (n logn)

quick sort complexity analysis (best case) | best case analysis of quick sort(best case) | T(n) = 2T(n/2) + n

quick sort complexity analysis (best case)


As we  know Recurrence of  quick sort is T(n) = 2T(n/2) + n      eq.1

             we solve it by Master Method
            step1 . compute  nlogba
here we compare eq.1  with T(n) = aT(n/b) + f(n)
          
                        a = 2 ,b=2 , f(n) = n
                       
               nlogba     à  nlog22      à n

step2.  we compare  function f(n)  with nlogba  
               here from eq.1 
                   f(n)    =  n  &
                     nlogba     =   n
i.e          f(n)  and  nlogba  are equal
                  f(n) = θ (nlogba)

so case 2 of Master Method is applied
step3.
T(n) =  θ (nlogba.logn)                            eq.2
put  value of nlogba  à  nlog22  à n   into eq.2
T(n) = θ (nlogn)      Answer

Longest Common Subsequence (LCS)|Analysis of Algorithms|Algotech Programming Concept

Longest Common Subsequence (LCS)|Analysis of Algorithms|Videos


LONGEST COMMON SUBSEQUENCE (LCS)-PART-1 With Example


LONGEST COMMON SUBSEQUENCE (LCS)-PART-2 


PRINT LONGEST COMMON SUBSEQUENCE (LCS)




T(n) = 2 T(n/4) + √n | Master Theorem | Master Method | time complexity for recurrence

                                                                     T(n)  = 2 T(n/4) + √n      eq.1 we solve it by Master Method ...