Question

float useless(A){ n = A.length; if (n==1) { return A[@]; let A1,A2 be arrays of size n/2 for (i=0; i <= (n/2)-1; i++){ A1[i]

0 0
Add a comment Improve this question Transcribed image text
Answer #1
complexity of first for loop is n/2 = O(n) times.
complexity of second for loop is O(n^2) times.
so, work done inside a recursive call is O(n^2)
two recursive calls are made of size n/2
so, recurrence relation is T(n) = 2T(n/2) + O(n^2)

T(n) = 2T (n/2) + O(nº) This is in the form of T(n) = a1 + f(n) so, we can use masters theorem. compare nlogta with f(n) a =Answer: O(n2)
Add a comment
Know the answer?
Add Answer to:
float useless(A){ n = A.length; if (n==1) { return A[@]; let A1,A2 be arrays of size...
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