big o - Intro to Algorithms (chapter 1-1) -


just reading book fun, isn't homework.

however confused on first main assignment:

1-1 comparison of running times

for each function f(n) , time t in following table, determine largest size n of problem can solved in time t, assuming algorithm solve problem takes f(n) microseconds.

what mean?

the next table shows bunch of times along 1 axis (1 second, 1 minute, 1 hour, etc), , other axis shows different f(n) such lg n, sqrt(n), n, etc.

i not sure how fill in matrix because can't understand question. if f(n) = lg n, it's asking largest n can solved in, example, 1 second, problem takes f(n) = lg n microseconds solve? last part mean? don't know how set equations / ratios solve problem because literally can't put meaning of question.

my hangup on sentence "assuming algorithm solve problem takes f(n) microseconds" because don't know refers to. time what algorithm solve what problem takes f(n) microseconds? if call f(100) it'll take lg 100 microseconds? need find n f(n) = lg n microseconds = 1 second?

does mean lg n microseconds = 1 second when lg n microseconds = 10^6 microseconds, n = 2^(10^6)?

for each time t, , each function f(n), required find maximal integer n such f(n) <= t

for example, f(n) = n^2, t=1sec = 1000 ms:

n^2 <= 1000 n <= sqrt(1000) n <= ~31.63 <- not integer n <= 31 

given function f(n), , time t, required find maximal value of n, , fill in table.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -