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