algorithm to compute waiting time for FCFS scheduling in python

前端 未结 3 1326
庸人自扰
庸人自扰 2021-01-29 10:17

Consider the following code that takes input processes and their arrival times and sort them according to FCFS algorithm, so i\'ve been thinking about algorithms to compute avg

3条回答
  •  面向向阳花
    2021-01-29 10:54

    process_queue[i].append(int(list1[i])

    you are appending the i'th element of list1 to the process_queue list , You should note that list1[i] is not a list but an integer . and in next line you are trying to access

    total_wtime += process_queue[i][1]

    1st element of the process_queue[i] but it is not a 2d array

    total_wtime += process_queue[i]

    should work .

提交回复
热议问题