Homework for circular buffer