Write a C program ( Care should be taken not to use extensions of C + + ) that c
ID: 3553020 • Letter: W
Question
Write a C program (Care should be taken not to use extensions of C + +) that computes the result of Catalan numbers defined as:
C(1)=1
(C(n)= sum_{i=1}^{n-1} C(i)C(n-i)) n >1
The first five terms of the sequence are: 1, 1, 2, 5 and 14. Your program should calculate the result of two different ways, each way corresponding to a distinct function:
a) using a recursive function as defined above
b) using a function that calculates two "for" loops of the following formula (equivalent to the recursive formula):
(C(n) = (1/n)((2n-2)
Explanation / Answer
Fine the code here : http://ideone.com/PTSe4W
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.