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

Most popular questions from this chapter

Show that any binary integer is at most four times as long as the corresponding decimal integer. For very large numbers, what is the ratio of these two lengths, approximately?

Digital signatures, continued.Consider the signature scheme of Exercise 1.45.

(a) Signing involves decryption, and is therefore risky. Show that if Bob agrees to sign anything he is asked to, Eve can take advantage of this and decrypt any message sent by Alice to Bob.

(b) Suppose that Bob is more careful, and refuses to sign messages if their signatures look suspiciously like text. (We assume that a randomly chosen messagethat is, a random number in the range{1,...,N-1} is very unlikely to look like text.) Describe a way in which Eve can nevertheless still decrypt messages from Alice to Bob, by getting Bob to sign messages whose signatures look random.

The algorithm for computing abmodCby repeated squaring does not necessarily lead to the minimum number of multiplications. Give an example of b>10where the exponentiation can be performed using fewer multiplications, by some other method.

In an RSA cryptosystem, p = 7and q = 11(as in Figure 1.9). Find appropriate exponents and .

A positive integer N is a power if it is of the formqk , where q,role="math" localid="1658399000008" k are positive integers and k>1.

(a) Give an efficient algorithm that takes as input a number and determines whether it is a square, that is, whether it can be written asq2 for some positive integer q. What is the running time of your algorithm?

(b) Show that if N=qk (with role="math" localid="1658399171717" N,q , andk all positive integers), then either role="math" localid="1658399158890" klogNorN=1.

(c) Give an efficient algorithm for determining whether a positive integerN is a power. Analyze its running time.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free