Implementaition of a queue based on a dynamic array