Answer to Question #247991 in Algorithms for Sonu

Question #247991

Examine what Big-O notation is and explain its role in evaluating efficiencies of algorithms. Write the Python program code for the above two algorithms and critically evaluate their efficiencies using Big-O notation.


1
Expert's answer
2021-10-07T14:00:44-0400

Big O notation is a mathematical representation, which describe the liming behavior of a function when the argument tends towards the particular value or infinity. In the computer science, we analyze the cost of an algorithm.

def factorial(n):
    product = 1
    for i in range(n):
        product = product * (i+1)
    return product

print (factorial(8))

Here, there is one for loop, so complexity of the in big O notation O(n).


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS