Common Time Complexity

partition recursion

T(N) = 2T(N/2) + N ----> O(NlogN)
T(N) = 2T(N/2) + 1 ----> logN
T(N) = T(N/2) + 1 ----> logN
T(N) = T(N/2) + N ----> N

tail recursion

T(N) = T(N-1) + 1 ---> O(N)
T(N) = T(N-1) + N ---> O(N^2)
T(N) = 2T(N-1) + 1 ---> O(2^N)

你可能感兴趣的:(Common Time Complexity)