The Recursive Formula For Catalan Number Is Given By Cn Cicnibr #2120
The recursive formula for Catalan number is given by Cn = ∑Ci*C(n-i).<br /> Consider the following dynamic programming implementation for Catalan numbers:</p> <pre><code class="language-c"> #include<stdio.h> int cat_number(int n) { int i,j,arr[n],k; arr[0] = 1; for(i = 1; i < n; i++) { arr[i] = 0; for(j = 0,k = i - 1; j < i; j++,k--) ______________________; } return arr[n-1]; } int main() { int ans, n = 8; ans = cat_number(n); printf("%d\n",ans); return 0; }</code></pre> <p>Which of the following lines completes the above code?
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Dynamic Programming - Catalan Number using Dynamic Programming - Quiz No.1.
The recursive formula for Catalan number is given by Cn = ∑Ci*C(n-i).
Consider the following dynamic programming implementation for Catalan numbers:
Consider the following dynamic programming implementation for Catalan numbers:
#include<stdio.h> int cat_number(int n) { int i,j,arr[n],k; arr[0] = 1; for(i = 1; i < n; i++) { arr[i] = 0; for(j = 0,k = i - 1; j < i; j++,k--) ______________________; } return arr[n-1]; } int main() { int ans, n = 8; ans = cat_number(n); printf("%d\n",ans); return 0; }
Which of the following lines completes the above code?
arr[i] = arr[j] * arr[k];
arr[j] += arr[i] * arr[k];
arr[i] += arr[j] * arr[k].
arr[j] = arr[i] * arr[k];
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes