I need help with the following recurrence relation.
T(1) = 1
T(n) = T(n-1)*n
This is what I've tried. I think I might have messed up the substitution part but again please take a look at let me know if the time complexity I've got is correct.
T(n) = T(n-1)*n T(n-1) = T(n-2)*n-1
T(n) = [T(n-2)*(n-1)]*n
T(n) = T(n-2)*(n-1)*n
T(n) = [T(n-3)*n-2]*(n-1)*n
T(n) = T(n-3)*(n-2)*(n-1)*n
...
...
...
T(n) = T(n-k)*(n-(k-1))*(n-(k-2))...*(n-1)*(n)
Assuming n-k=0, n=k
T(n) = T(n-n)*(n-n+1)*(n-n+2)...*(n-1)*(n)
T(n) = T(0)*(1)*(2)...*(n-1)*n
O(n^2)
Now I am not sure if what I did was exactly correct or not but any help would be appreciated.