Question

T2(N) = Θ(N) Which algorithm is the least preferred one? a) Algorithm 1 b) Algorithm 2 ) Algorithm 3 Algorithm 1 and 3 2. Given the following function: (10 points) int F(int N) if (N0lIN1) return 2; else return N *FON-2); Show steps to find out F(5) Also give the runtime
0 0
Add a comment Improve this question Transcribed image text
Answer #1
F(5)
= 5 * F(3)
= 5 * 3 * F(1)
= 5 * 3 * 2
= 5 * 6
= 30

so, F(5) is 30

runtime complexity is O(n)

Please let me know i f you need me to make anu changes

Add a comment
Know the answer?
Add Answer to:
T2(N) = Θ(N') Which algorithm is the least preferred one? a) Algorithm 1 b) Algorithm 2...
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