Data Structure Questions and Answers-Minimum Number of Jumps

YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

CLICK HERE TO DOWNLOAD

Data Structure Questions and Answers-Minimum Number of Jumps

Question 11 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the output of the following program?

#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[] ={9,  9,  9,  9,  9,  9,  9,  9,  9}, len = 9; int ans = min....jump(arr, len); printf("%d\n", ans); return 0; }
A
1
B
6
C
2
D
7
Question 11 Explanation: 
The program prints the minimum jumps required to reach the end of the array, which is 1 and so the output is 1.

There are 11 questions to complete.