Computer Science, asked by vaibhavsingh161997, 1 month ago

A milling machine in a manufacturing facility has tool chang system.The tool changer holds n tools and some duplicate tools may be included.The operator must move through the tools one at a time either left or right .The tool changer is circular,so when the last tool in the tools array is reached in either direction,the next tool is at the either end of the array

Answers

Answered by nakshatra17122006
0

i know but i will not say

because u it self identyfy

Answered by sujan3006sl
0

Answer:

def minJumps(arr, l, h):

   if (h == l):

       return 0

   if (arr[l] == 0):

       return float('inf')

   min = float('inf')

   for i in range(l + 1, h + 1):

       if (i < l + arr[l] + 1):

           jumps = minJumps(arr, i, h)

           if (jumps != float('inf') and

                      jumps + 1 < min):

               min = jumps + 1

   return min

Explanation:

Approach:

  • Start with the initial element and call for all the items that are reachable from it in a recursive manner.
  • The smallest number of leaps required to reach the finish from the elements accessible from the beginning may be used to determine the minimal number of jumps to reach the end from the beginning.

Complexity Analysis:

  • Time complexity: O(n^n).
  • Auxiliary Space: O(1).

#SPJ3

Similar questions