What Is The Value Stored In Arr24 When The Following Code Is #2149
What is the value stored in arr[2][4] when the following code is executed?</p> <pre><code class="language-c"> #include<stdio.h> #include<string.h> int max(int a, int b) { if(a > b) return a; return b; } int min_ins(char *s) { int len = strlen(s), i, j; int arr[len + 1][len + 1]; char rev[len + 1]; strcpy(rev, s); strrev(rev); for(i = 0;i <= len; i++) arr[i][0] = 0; for(i = 0; i <= len; i++) arr[0][i] = 0; for(i = 1; i <= len; i++) { for(j = 1; j <= len; j++) { if(s[i - 1] == rev[j - 1]) arr[i][j] = arr[i - 1][j - 1] + 1; else arr[i][j] = max(arr[i - 1][j], arr[i][j - 1]); } } return len - arr[len][len]; } int main() { char s[] = "abcda"; int ans = min_ins(s); printf("%d",ans); return 0; }</code></pre>
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 - Minimum Insertions to form a Palindrome - Quiz No.2.
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