CodePudding user response:
CodePudding user response:
Can you help me the little brother I really don't know how to doCodePudding user response:
General term formula amIt is purely mathematical problems
For I a example:
T (n.) - T (n - 1)=n ^ 2
T (n - 1), T (n - 2)=(n - 1) ^ 2
.
T (2) - (1)=2 T ^ 2
T (1)=1
So T (n)=1 + 2 ^ 2 + 3 ^ 2 +... + n ^ 2=1/6 * n * (n + 1) * (2 n + 1)
This is O (n ^ 3).
The second question, T (n)=log (1) + log (2) +,,, + log (n)
10 ^=log (log (1) + log (2) +... The log (n))=log (10 ^ log * 10 ^ (1) the log (2) *... 10 ^ log (n))
=log (1 * 2 * 3 *.. * n)
=log (n.)
O (log (n.) ) and O (nlog (n)) are equivalent, that TMD Stirling formula should be used to prove the limit, the number of high thing don't speak
Are similar problems, high number to bad, why is why should go to, always can't open the high number of the lecture hall