当前位置:网站首页>Problems with cat and dog queues
Problems with cat and dog queues
2022-06-28 04:06:00 【The roaring Conan】
Cat dog queue
【 subject 】
Pets 、 The categories of dogs and cats are as follows :

Implementation of a dog and cat queue structure , Requirements are as follows :
● Users can call add Methods will cat Class or dog Class to queue ;
● Users can call pollAll Method , Pop up all instances in the queue in the order of entering the queue ;
● Users can call pollDog Method , Queue up dog The instances of the class pop up in the order of entering the queue ;
● Users can call pollCat Method , Queue up cat The instances of the class pop up in the order of entering the queue ;
● Users can call isEmpty Method , Check if there are any in the queue dog or cat Example ;
● Users can call isDogEmpty Method , Check if there are any in the queue dog Class ;
● Users can call isCatEmpty Method , Check if there are any in the queue cat Class .
【 Ideas 】
This question examines the ability to implement special data structures and the ability to design algorithms for special functions .
This is an open type interview question , I hope the readers can have their own realization , Here are a few common design mistakes :
● cat Queue only cat example ,dog Queue only dog example , And then use a general queue to put all the instances . The reason for the error :cat、dog And the update of the general queue .
● Using hash table ,key It means a cat Example or dog example ,value Indicates the order in which this instance is queued . The reason for the error : An instance cannot be queued multiple times
边栏推荐
猜你喜欢

【小程序实战系列】电商平台源码及功能实现

2021年终总结及2022年展望

【毕业季】研究生の毕业总结

English语法_形容词/副词3级-比较级_常用短语

Web APIs DOM event foundation dark horse programmer

Cannot edit in read-only editor if it appears in vscode

The operating mechanism of spectrogram in audio Science

使用tensorboard进行loss可视化

Learning notes of digital circuit (II)

leetcode - 329. 矩阵中的最长递增路径
随机推荐
等保三级密码复杂度是多少?多久更换一次?
KVM常用命令详解
gcd最大公约数
【毕业季】研究生の毕业总结
Uncertainty principle
Are the two flame retardant standards of European furniture en 597-1 and en 597-2 the same?
《性能之巅第2版》阅读笔记(二)--CPU监测
What is the process of en 1101 flammability test for curtains?
Arrangement of basic electrical knowledge (I)
从零到一,教你搭建「以文搜图」搜索服务(一)
02 MongoDB数据类型、重要概念以及shell常用指令
用Pycharm开发Flask框架设置debug模式没有效果的解决办法
猫狗队列的问题
Notes to friendship chain
MSc 307 (88) (2010 FTPC code) Part 5 low flame spread test
MSC 307(88) (2010 FTPC Code) Part 5低播焰测试
仅用递归函数和栈操作逆序一个栈
Does the applet image component not display pictures?
Backtracking maze problem
Zipkin service link tracking