Closed ofreiberg closed 10 years ago
Here's an English description:
put an item called t of type T in the queue: if the array is full, resize it (ie if front is about to be back) then put the the item t at the back of the array.
the %q.length is used everywhere to make sure we always go around the edge of the array.
public void put(T t) { if((back+1)%q.length==front%q.length) resize(); q[back++%q.length]=t; }
how does this line work/what exactly does this line do? lines 13-16