Computer Science, asked by 2022simpysingh, 6 months ago

a milling machine in a manufacturing facility has a tool change syatem .The tool changer holds n tools and some duplicate tools find minimum backward and forward tool write a program in java

Answers

Answered by sachdeva8701
7

kya chiutiyap hh ye bchhhh

Answered by ravilaccs
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).

Similar questions