Question

Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i= 0; i<N; i++)

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

I don't know that, you know about Big(O) or not. So i am explaining it little here.

image contains that part,

PCn) าวุ YM So, e Called it as (n) C) a S then 0 2 Vale of 2 plotic molation 5ys abovt ho the оч f we ncease the imput size e

now coming to your question, there are two nested for loops in which both loops running is independent(like no one is changing other loops iterative variable) . first for loop is running for N iteration and in each of that iteration inner loop is running for N/2 times. So total running time is N times N/2 which is total N(N/2)= N^2/2.

So your order of magnitude for this problem is Oleft ( N^2 ight ) and this is tight bound which can't be decreased.

Add a comment
Know the answer?
Add Answer to:
Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i=...
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