Part 1b. Further optimize the algorithm to eliminate the slowest tests first.
So, consider the definition of the problem changes from just having a list of items t
to the same list, but now we know the exec time of each item.
So the initial input:
N=240
t = list(range(N))
now changes to:
from random import randint
random.seed(42) # get reproducible results while experimenting
N=240
t = [[i,int(randint(1,100))] for i in range(N)]
so each item is:
[seq_num, exec_time]
since some tests are much slower than others we want to eliminate slow tests from the lists first, which can significantly impact the total run-time. of course, at the end we will have real exec times of each test, but for figuring out an efficient algorithm, random numbers is just fine.
You will most likely want to set a RNG seed while you develop this as I have shown in the code above.