Question

Find the worst case runtime f(n) for the following algorithms.

  • Specify the number of operations executed for an input size n, for the worst case run time as a function of n.
  • Circle statement(s) and draw a   line to the right side specifying the number of operations.
  • If statement(s) are a part of an iteration of n, specify the total number of iterations as a function of n.
  • Algorithm-01 int sum = 0; int j = 1; while ( <= n) { sum++; j-j.2; } Algorithm-02 int sum - 0; for (int i = 1; i <= n * 2; i+
0 0
Add a comment Improve this question Transcribed image text
Answer #1

# STAY HOME # STAY SAFE

The solution to the above problem is given in the attached images.Please refer.

If you have any queries please comment in the comments section and kindly upvote.

Solution- 1.2 int sum = 0; int while lean) # No of operations log(n) sum tt; to tlagn Tatab no-ofoperations. It log.com) +log3 #No of operations int sum = 0 fort int i=1; icin; i++) fortint <= 1000000; j++) 106m n asf sum += 100 106m sun to 9999 Itni4.) #No. of operations 1 int sum=0; fortint i = 1; i =n; i++) fort int jal; jc = i; ji 4 m mm له n(n+1)/2 suma sum titji n(n+Х (= (429 | + - + + + () t 41. . , . . . + 1 + + |

Add a comment
Know the answer?
Add Answer to:
Find the worst case runtime f(n) for the following algorithms. Specify the number of operations executed...
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