Question: Trying to desgin a C++ program. solve recurrence t(n)=t(n-1)+n, for n>1, t(1)=a; where a is some constant of type double Enter a and n 1.

Trying to desgin a C++ program.

solve recurrence t(n)=t(n-1)+n, for n>1, t(1)=a; where a is some constant of type double

Enter a and n 1. Find t(a, n) using recursion What is complexity of your solution, when you use recursion?

2. find t(a,n)==f(a,n) in O(1) complexity

Provide code for both solutions. for n<1, t(a,n) is not defined, so throw exception if user enters not number, and throw exception if user enters number less than 1 catch both exceptions and ask user to re-enter n value

Intended output can be provided if needed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!