Question

Show your work Count the number of operations and the big-O time complexity in the worst-case...

Show your work

Count the number of operations and the big-O time complexity in the worst-case and best-case for the following code

int small

for ( i n t i = 0 ; i < n ; i ++)

{

i f ( a [ i ] < a [ 0 ] )

{ small = a [ i ] ;

}

}

Show Work

Calculate the Big-O time complexity for the following code and explain your answer by showing all calculation.

for ( int i = 0 ; i < n ; i ++)

{

for ( int j = 0 ; j < n∗n ; j ++)

{ cout <<” t r i c k y ! ”<< endl ;

}

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

if you have any doubts please post an comment.don't dislike.

- 1) int small for (int i=0; i<n; itt) ? if (a[i] caso]) {small = a[i]; o (nt2) 0(1) 0(1) = 0h42) [60674001) - 0 (nt2) big-o2) for (int i=0; i<n; itt) ~ o(at2) a for (int j = 0; je na n; j++) 0 (02) { count ch tricky! 22 endl; -3 0(1) - O(n+2) [O

Add a comment
Know the answer?
Add Answer to:
Show your work Count the number of operations and the big-O time complexity in the worst-case...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT