Which pair of functions satisfy f (N) ~g(N)?

后端 未结 2 1213
臣服心动
臣服心动 2021-01-28 04:42

I\'ve just started working with algorithms and I am doing some tasks like this question:

I think, the right answer is A. As the functions are the same, or do I miss some

2条回答
  •  遥遥无期
    2021-01-28 05:40

    The answer is A. Notice that in that case,

    f(N) = N + 2N + 3N = 6N = g(N)

    so f(N) ~ g(N).

    For the functions given in B, notice that

    f(N) = (N + 1) + (N + 2) + (N + 3) = 3N + 6

    so the limit of f(N) / g(N) as N tends toward infinity is 3, and therefore f(N) is not tilde of g(N).

    For the functions in C, notice that

    f(N) / g(N) = 1 / N5 + 1 / N4 + 1 / N3

    and, in the limit, this does not tend to one.

    For the functions in D, notice that

    f(N) = log N + log 2N + log 3N = log 6N3 = 3 log 6N

    so the limit of f(N) over g(N) as N tends toward infinity is 3, so the functions aren't tilde of one another.

提交回复
热议问题