Algorithm analysis, oil pipeline problem c program