Home / MCQ Bank / Computer
Computer Dynamic Programming In Data Structures

What is the time complexity of the following dynamic programming implementation used to find the minimum number of jumps? #include<stdio.h> #include<limits.h> int min_jump(int *arr, int len) { int j, idx, jumps[len]; jumps[len - 1] = 0; for(idx = len - 2; idx >= 0; idx--) { int tmp_min = INT_MAX; for(j = 1; j <= arr[idx] && idx + j < len; j++) { if(jumps[idx + j] + 1 < tmp_min) tmp_min = jumps[idx + j] + 1; } jumps[idx] = tmp_min; } return jumps[0]; } int main() { int arr[] ={1, 1, 1, 1, 1, 1, 1, 1, 1},len = 9; int ans = min_jump(arr,len); printf("%d\n",ans); return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • O(n 2 )

Related Computer Questions

What is the auxiliary space requirement of cycle sort? Which of the following command options are displayed when you use the Router# show frame-relay ? command? 1. dlci 2. neighbors 3. lmi 4. pvc 5. map On which part of the chart are the values entered in a data sheet displayed? Continuous line drawing are produced using Which NLP technique involves determining the syntactic structure of a sentence, including its grammatical relationships between words?