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

天大地大妈咪最大 提交于 2019-12-04 06:04:14

问题


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 something?

Question:


回答1:


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.




回答2:


Yes, A is the correct answer.

Tilde here means an (approximate, not precise) equivalence relation. Or in other words, the limit of f(N) / g(N) as N approaches infinity = 1.

In answer A, f and g are obviously equivalent, so the limit is 1. This doesn't hold for the other three answers, which have limits 3, 0, and 3 respectively.



来源:https://stackoverflow.com/questions/36463202/which-pair-of-functions-satisfy-f-n-gn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!