Consider The Following Recursive Implementationp Pre Langc #2036
Consider the following recursive implementation:</p> <pre><code class="language-c"> #include<stdio.h> #include<limits.h> int min_jumps(int *arr, int strt, int end) { int idx; if(strt == end) return 0; if(arr[strt] == 0) // jump cannot be made return INT_MAX; int min = INT_MAX; for(idx = 1; idx <= arr[strt] && strt + idx <= end; idx++) { int jumps = min_jumps(____,____,____) + 1; if(jumps < min) min = jumps; } return min; } int main() { int arr[] ={1, 3, 5, 8, 9, 2, 6, 7, 6},len = 9; int ans = min_jumps(arr, 0, len-1); printf("%d\n",ans); return 0; }</code></pre> <p>Which of these arguments should be passed by the min_jumps function represented by the blanks?
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 Number of Jumps - Quiz No.1.
Consider the following recursive implementation:
#include<stdio.h> #include<limits.h> int min_jumps(int *arr, int strt, int end) { int idx; if(strt == end) return 0; if(arr[strt] == 0) // jump cannot be made return INT_MAX; int min = INT_MAX; for(idx = 1; idx <= arr[strt] && strt + idx <= end; idx++) { int jumps = min_jumps(____,____,____) + 1; if(jumps < min) min = jumps; } return min; } int main() { int arr[] ={1, 3, 5, 8, 9, 2, 6, 7, 6},len = 9; int ans = min_jumps(arr, 0, len-1); printf("%d\n",ans); return 0; }
Which of these arguments should be passed by the min_jumps function represented by the blanks?
arr, strt + idx, end
arr + idx, strt, end
arr, strt, end
arr, strt, end + idx
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