cacheVector example from programming assignment 3