Q291
Consider the following algorithm for finding the nth Catalan number using dynamic approach. which of the following steps best fills the blank? 1) create and initialize a variable 'n' and an array 'c' 2) initialize the first two values of array as 1 3) _______________________ 4) return c[n]
A.
Traverse the array from 2 to n one by one and update the value as c[j] * c[i-j-1]
AnswerB.
Traverse the array from 2 to n one by one and update the value as c[i] * c[i-j-1]
C.
Traverse the array from 2 to n one by one and update the value as c[j] * c[i-1]
D.
Traverse the array from 2 to n one by one and update the value as c[i] * c[j-1]
Answer: Option A
Solution
Answer: Option A
No explanation is given for this question Let's Discuss on Board