Vidyalelo
Data Structure · Q219

Dynamic Programming in Data Structures

Programming · Data Structure · question 219

Q219

Consider the following recursive implementation: #include #include 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 ",ans); return 0; Which of these arguments should be passed by the min_jumps function represented by the blanks?

A.
arr, strt + idx, end
Answer
B.
arr + idx, strt, end
C.
arr, strt, end
D.
arr, strt, end + idx

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board