implementation for queue in array style