Search code examples
algorithmrecursioncomplexity-theorydeterminants

Proving the complexity of recursive determinant


I want to prove why Laplace determinant or recursive algorithm complexity is n!. Can anyone prove it for me? I don't know how could it then be n!, given that the equation T(n)=nT(n-1)+3n-1 only involves multiplication and addition.


Solution

  • Try to expand:

    T(n) = n T(n-1) + 3n-1 = 
           n ((n-1)T(n-2) + 3(n-1)-1) + 3n-1 =
           n (n-1) T(n-2) + 3 n (n-1)  - n + (3n - 1)
    

    Now by induction you can show that (if T(1) = 1):

    T(n) = n (n-1) (n-2) ... 1 + 3(n + n (n-1) + ... + n!) - 
          (1 + n + n (n-1) + ... + n (n-1) ... n * (n-1) * ... * (n-2)) 
         = Theta(n!)