Looking at this again, wouldn't it make sense to use a queue here rather than a linked list?  That way insertion is O(1) rather than O(n).