Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Show that log(n!)=θ(nlogn)

(Hint: To show an upper bound, compare (n!) with nn. To show a lower bound, compare it with (n2)n2).

Short Answer

Expert verified

The statement logn!=θnlognis proved.

Step by step solution

01

Explain Asymptotic notation.

Big O notation provides an asymptotic upper bound on a function, and omega notation provides an asymptotic lower bound. Three asymptotic notations are used to represent the time complexity of algorithms. They are: Big-O notation, Omega notation and Theta notation.

02

Prove the equation by upper bound.

The given equation is:

logn!=θnlogn

Let the right-hand side derivation be log(n!).

logn!=log1×2×3............n-1×nlogn!=log1+log2+log3..........+logn

From here, it is clear that log1logn

logn!logn+logn+logn.....+lognlogn!nlogn

03

Prove the given equation by lower bound.

Now, prove for omega notation.

logn!=Ωnlogn

Let the left-hand side derivation ben!2.

n!2=n!×n!n!2=n×1×n-1×2×n-2×3×..........×1×nn!2=k=1nn-k+1×nn!2=k=1n-k2+nk+k

Here a quadratic equation is obtained, which is equal to data-custom-editor="chemistry" fk.

fk=-k+nk+kwhere data-custom-editor="chemistry" 1kn…….…(1)

Here, put the value of k in the equation (1).

fkmin=-12+n×1+1fkmin=n

Equate both the equations:

n!2=k=1nfkn!2k=1nfkminn!2k=1nnn!2nn

Taking logon both sides:

logn!2lognn2logn!nlognlogn!n2lognlogn!nlogn

So, the final answer obtained is logn!=θnlogn

Hence data-custom-editor="chemistry" logn!=θnlognis proved.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free