《CITI》P145
3 栈与队列
题目:
3.7 An animal shelter holds only dogs and cats, and operates on a strictly “first in, first out” basis. People must adopt either the “oldest” (based on arrival time) of all animals at the shelter, or they can select whether they would prefer a dog or a cat (and will receive the oldest animal of that type). They cannot select which specific animal they would like. Create the data structures to maintain this system and implement operations such as enqueue, dequeueAny, dequeueDog and dequeueCat. You may use the built-in LinkedList data structure.

本文介绍了一个动物收容所的数据结构设计方案,该收容所仅收容猫和狗,并采用严格的“先来先服务”原则。文章详细阐述了如何实现enqueue、dequeueAny、dequeueDog和dequeueCat等操作。
233

被折叠的 条评论
为什么被折叠?



