jim is excited because he has just been delivered a new computer but he has a dilemma. it seems that the operation system scheduling works a little differently compared to what he has been before.he finds that he cannot force the computer to switch tasks and tasks that were given to the computer earlier are being executed after tasks that were submitted at later time. he now has the task of figuring out the time at which a batch of tasks will be completed given their submit times and runtime duration. note: if 2 tasks are submitted at the same time , the one encountered earlier in the input array is executed first.
input1: N number of tasks
input2:an array of N elements. each element contains: of ith task.
input3:an array of N elements.each elements contains :of ith task.
output: the function should return the final end time of the last task to be executed.
example 1:
input1:1
input2:{0}
input3:{4}
output:4
example2:
input1:5
input2:{0,3,9,2,6}
input3:{3,4,2,9,6}
output:24
Answers
Answer:
worries I can do that I don't have a I can do that when I can get the money from the money from you and your family are doing well and staying home with you and your family are doing is a little bit ago and staying in a
Explanation:
sleeping I can get it to the money I can do that when I don't have to the money from the money from
input1: N number of tasks
input2:an array of N elements. each element contains: of ith task.
input3:an array of N elements.each elements contains :of ith task.
output: the function should return the final end time of the last task to be executed.
PYTHON CODE
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
# Driver program to test above function
arr = [1, 3, 6, 3, 2, 3, 6, 8, 9, 5]
n = len(arr)
print('Minimum number of jumps to reach',
'end is', minJumps(arr, 0, n-1))
#SPJ1