Monday, September 14, 2020

#205 In term of big O, what is the complexity time

In term of big O, what is the complexity time - Computer Science

ChemistryExplain daily providing Q&A content “#205 In term of big O, what is the complexity time" in Computer science, Ba computer science, Berkeley computer science, Computer science associate degree jobs.

ChemistryExplain “#205 In term of big O, what is the complexity time in Computer science, Ba computer science, Berkeley computer science, Computer
Get the Free Online Chemistry Q&A Questions And Answers with explain. To crack any examinations and Interview tests these Chemistry Questions And Answers are very useful. Here we have uploaded the Free Online Chemistry Questions. Here we are also given the all chemistry topic.

 ChemistryExplain team has covered all Topics related to inorganic, organic, physical chemistry, and others So, Prepare these Chemistry Questions and Answers with Explanation Pdf.

For More Chegg Questions

Free Chegg Question

In term of big O, what is the complexity time of each of the following (each one 0.25pt.)

ChemistryExplain “#205 In term of big O, what is the complexity time in Computer science, Ba computer science, Berkeley computer science, Computer

For More Chemistry Notes and Helpful Content Subscribe Our YouTube Chanel - Chemistry Explain  

Free Chegg Answer

1)
outer loop iterates n times
inner two loops combined loops n times
total number of iterations = n^2
Answer: O(n2)

2)
outer loop iterates n times
middle loop iterates n times
inner loop iterates 10 times
total number of iterations = n*n*10 = 10n^2
Answer: O(n2)

3)
outer loop iterates n times
inner loop iterates n-i times, which is O(n) in worst case.
total number of iterations = n*O(n) = O(n^2)
Answer: O(n2)

4)
outer loop is iterating log(n) times. because i is increased by a factor of 2. i = i*2;
inner loop iterates 5 times.
so, total number of iterations = log(n) * 5
Answer: O(log(n))

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home