Question

Find the time Complexity of the following code show the process j = 1; m =...

Find the time Complexity of the following code

show the process

j = 1;
m = [];
while j <= size(s,2)
m1 = 0;
i = 1;
while i <= size(c,2)
try
m1 = m1 + X(c(i),s(j));
i = i + 1;
catch
i = i + 1;
end
end
m = [m m1/size(c,2)];
j = j + 1;
end

end

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

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Let the size of matrix s is n and size of matrix c is m.

So, since there are 2 nested loops and all inside operations are constant.

So, the total time complexity will be O(n*m) where size of matrix s is n and size of matrix c is m.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Find the time Complexity of the following code show the process j = 1; m =...
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