array implementation for stack and queue