Handle cases with only one process

Replaced do-while with while loop to avoid reading uninitialized memory
if there's only one process given in the input file