主定理f(n)= nlogn

时间:2019-03-06 05:25:27

标签: algorithm time-complexity master-theorem

我正在研究第三版算法导论中的问题4-3。然后要求我找到T(n)的渐近上下限:

  

T(n)= 4T(n / 3)+ n lg(n)

我已经在线浏览了该解决方案,并且解决方案显示:

  

根据大师定理,我们得到T(n)∈Θ(n log 3 (4)

我认为该解决方案假设n log 3 4 渐近大于n lg(n)?但是为什么这是真的呢?如果有人可以帮助我理解我,我将不胜感激!

1 个答案:

答案 0 :(得分:0)

用外行的话来说:

我们需要比较# the upstream component nginx needs to connect to upstream django { server unix:///my-app/socketfiles/nginx-django.sock; # for a file socket #server 127.0.0.1:8001; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 8443; # the domain name it will serve for server_name example.com; # substitute your machine's IP address or FQDN charset utf-8; # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias /my-app/code/media; # your Django project's media files - amend as required } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /my-app/code/uwsgi_params; # the uwsgi_params file you installed } } n*log(n)n^1.25)的增长情况

将两个函数除以n

log3(4)~1.26

两者都在增加。
这两个函数的导数

  log(n) vs n^(1/4)

第二个函数的导数明显更大,因此第二个函数增长更快

We can see,这些函数的曲线相交,幂函数对于较大的n值变大-对于任何 n^(-1) vs n^(-3/4)