Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  The following statement is valid. log(n!) =&#... Start Learning for Free
The following statement is valid. log(n!) = θ(n log n).
  • a)
    True
  • b)
    False
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
The following statement is valid. log(n!) =θ(n log n).a)Trueb)Fal...
Order of growth of [Tex]log n![/Tex] and [Tex]nlog n[/Tex] is same for large values of [Tex]n[/Tex], i.e., [Tex] heta (log n!) = heta (nlog n)[/Tex]. So time complexity of fun() is [Tex] heta (nlog n)[/Tex]. The expression [Tex] heta (log n!) = heta (nlog n)[/Tex] can be easily derived from following Stirling's approximation (or Stirling's formula). [Tex] log n! = nlog n - n +O(log(n)) [/Tex]
View all questions of this test
Most Upvoted Answer
The following statement is valid. log(n!) =θ(n log n).a)Trueb)Fal...
Explanation:

To prove the given statement, we can use Stirling's approximation formula which states that:

n! ≈ √(2πn)(n/e)^n

Taking the logarithm of both sides, we get:

log(n!) ≈ log(√(2πn)(n/e)^n)

log(n!) ≈ log(2πn)/2 + n log(n/e)

log(n!) ≈ log(2πn)/2 + n(log(n) - log(e))

log(n!) ≈ log(2πn)/2 + n(log(n) - 1)

Now, we can simplify the above equation as follows:

log(n!) ≈ n(log(n) - 1) (since log(2πn)/2 is a constant)

Therefore, we can conclude that:

log(n!) = O(n log n)

Hence, the given statement is true.

HTML:

Explanation:


  • To prove the given statement, we can use Stirling's approximation formula which states that:


    • n! ≈ √(2πn)(n/e)^n


  • Taking the logarithm of both sides, we get:


    • log(n!) ≈ log(√(2πn)(n/e)^n)

    • log(n!) ≈ log(2πn)/2 + n log(n/e)

    • log(n!) ≈ log(2πn)/2 + n(log(n) - log(e))

    • log(n!) ≈ log(2πn)/2 + n(log(n) - 1)


  • Now, we can simplify the above equation as follows:


    • log(n!) ≈ n(log(n) - 1) (since log(2πn)/2 is a constant)


  • Therefore, we can conclude that:


    • log(n!) = O(n log n)


  • Hence, the given statement is true.

Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer?.
Solutions for The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice The following statement is valid. log(n!) =θ(n log n).a)Trueb)FalseCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev