I am struggling to solve this equation. I concluded that the Master Theorem does not apply in this situation so I tried to successively substitute the terms in order to solve this equation but cannot proceed. Could somebody tell me what would be the best way to solve this?
Thanx
As you deduced we can’t use the master theorem because of failure of a condition in case three.
but for a start we have n^(log_b a) = n(log_2 2) = n
now n < n* log(log(n))
So the contribution of the recursion term 2T(n/2) keeps on decreasing, as compared to the other term n*(log(log n))….Hence we can forget that term for now…
Now consider the term n(log(log n))
Expanding the recurrence but we give importance to this term, we have,
T(n) = 2^k * T(n/2^k) + n [ log(log(n/2^(k-1))) + log(log(n/2^(k-2)) ….. ]
putting 2^k as n we have,
T(n) = ignore first term + n [ log(log(2)) + log(log(4)) +…..+ log(log(2^(k-1))) ]
T(n) = ignore first term + n [ log(1) + log(2) + log(3) +……+ log(k-1) ]
T(n) = ignore first term + n [ log((k-1)!) ]
We just need an upper bound, hence we can make use of Stirling’s approxiamation,
n! < (n/e)^n
hence (k-1)! ~ ((k-1)/e)^(k-1)
hence log((k-1)!) = (k-1)[(log(k-1) – log (e)]
but k = log n => [ log((k-1)!) ] = (log(n) – 1) [log(log(n)-1 – log(e)]
hence our term n [ log((k-1)!) ] = n*log(n)*log(log(n)) and some lower order terms which we can ignore..
Hence answer is: O(n*log(n)*log(log(n)))
PS: I am not sure of this answer, do check and tell if I have made some errors!