Question: ( 9 % ) To find the n th term of the sequence defined by a 0 = 1 , a 1 = 2 ,

(9%) To find the nth term of the sequence defined by a0=1,a1=2,a2=3, and an=an-1+an-2+an-3, for n=3,4,5,dots, we can use a recursive algorithm or an iterative algorithm.
(a)(3%) Please devise a recursive algorithm to achieve this goal.
(b)(3%) Please devise an iterative algorithm to achieve this goal.
(c)(3%) Is the recursive or the iterative algorithm for finding the sequence more efficient?
( 9 % ) To find the n th term of the sequence

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 Accounting Questions!