Two algorithms A and B solve the same algorithmic problem, A taking n^3 seconds and B taking n days.
(i) Which algorithm is asymptotically preferable?
(ii) How large does n need to be before B takes one-quarter of the time taken by A?
如何解决这些问题?有问题的帮助
我对(i)的回答是,随着n以渐近的速度增长,B更可取。这里的天和秒数是一个常数,因此当n接近无穷大时无关紧要。对于ii)我的猜测是2天。但是,不知道是否其他人得到了相同的
我想回答,但这真的属于http://math.stackexchange.com – 2011-05-18 16:39:22
尝试和写在(ii)中的信息在一个等式中。认为简单。同样,如果我说两个苹果花费10美元,你会说'2x = 10'并解决x,在这里做n。 – davin 2011-05-18 16:40:21
但实际上你只需要为方程(1/4)(n^3)= 24 * 60 * 60 * n'求解n。这很容易解决。 – 2011-05-18 16:41:03