Can you help me to solve Q2

I have a doubt in how to implement Q2…
Can anyone please explain me how to solve it…
https://1drv.ms/b/s!Al9xIYmMuIkqiDqb_djVuZ-hSWr5?e=ZL6kPy

https://1drv.ms/b/s!Al9xIYmMuIkqiDqb_djVuZ-hSWr5?e=ZL6kPy

Make a priority queue pair sorted by time when the task finishes and if same, sort by index of thread.
Take a variable curr_min.Set it to 0 initially because all the processors are free.
take a variable min_start_time which tells what the minimum start time could be for any thread i at this moment, this will remain zero as long as all the threads are not occupied, once they are occupied you need to set it to minimum time in which we can start this process.
So whenever you want to find the required thread, pop the thread pairs from the queue which have finished before the starting time of this thread and now assign the minimum of them to this task.

i have tried the same logic…can u pls send me your code

Okay give me some time , I still haven’t written the code for it

ok thanks…

Please see https://ide.codingblocks.com/s/252853, this passes the sample test cases.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.