You have to implement the shortest job first scheduling algorithm.
Shortest Job First is an algorithm in which the process having the smallest execution(burst) time is chosen for the next execution. Here, you will implement a non - preemptive version (a process will wait till process(es) with shorter burst time executes). You have to return the average waiting for the given number of processes.
Completion Time: Time at which process completes its execution.
SJF will schedule the job which is having least burst time.
Hence, Average waiting time = (5 + 0 + 2) / 3 = 2.33

Input format :
The first line contains a single integer 'N' which represents the number of processes.
The next 'N' lines contains two space-separated integers ‘at’ and ‘bt’ which represent arrival time and burst time for the 'ith' process, respectively.
Output format :
Print a floating value of 2 decimal points that represent average waiting time.
Note:
You don’t have to print anything; it has already been taken care of. Just implement the given function.
You have to return the answers up to two decimal places.
3
0 3
0 1
0 2
1.33
The table for the given number of processes is

Therefore, the average waiting for the given process is 1.33.
2
1 4
1 3
1.50
1 <= N <= 10^2
1 <= at, bt <= 10^3
Where 'N' denotes the number of processes, 'at' and 'bt' represents the arrival time and burst time of any process.
Time Limit: 1 sec.
Can you think of choosing the shortest job first?
The idea is to use the definition of the SJF. That is, first keep track of the process with the minimum arrival time because it will come first and then keep track of the process with the minimum burst time among the arrived process.
O(N ^ 2), where 'N' denotes the number of processes.
Since we are executing all the N processes and then for each process, we are checking for the minimum arrival and burst time of all the processes, i.e. we are iterating all the remaining processes in each iteration of outer loop. Therefore, total time complexity will be O(N) * O(N) = O(N ^ 2).
O(N), where ‘N’ denotes the number of processes.
Since we are creating new arrays to store all the waiting times, turn around times, completion times, completed processes. So, the net space complexity will be 4 * O(N) = O(N).