Nevermind, I've decided to rewrite this anyway in light of the new serial number.  I will sort the files.  This means the code is now Theta(n log n) instead of Big-Omega(n) (best case) and O(n^2) (worst case).  The number of log files should be small so I am not too concerned with the best case being worse