A linear time approximation algorithm for a storage allocation problem