I am trying to find the asymptotic run time complexity of the following function which will return a list of all permutations of nums.
def permute(nums): res =  dfs(nums, , res) return res def dfs(nums, curr, res): if not nums: res.append(curr) return for i in range(len(nums)): dfs(nums[:i]+nums[i+1:], curr+[nums[i]], res)
I think that the run time on an input of size $n$ is $T(n)=nT(n-1)+n$ because the function will make $n$ recursive calls on an input of size $n-1$ and it loops over $n$ terms. This gives $T(n)\in \mathcal O(n!)$ but some people say that it is $\mathcal O(n\cdot n!)$. Is the runtime of this $\mathcal O(n!)$ or $\mathcal O(n\cdot n!)$?