当前位置:网站首页>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
边栏推荐
- 小程序的防抖节流怎么写?
- 上线MES系统后,企业发生了这些变化......
- Staggered and permutation combination formula
- 2021年终总结及2022年展望
- 一千行 MySQL 学习笔记,值得收藏!
- 工业物联网将取代人工发展吗?
- 内卷、躺平与中年危机的相关思考
- Building log analysis system with elk (II) -- deployment and installation
- 友链须知
- Are the two flame retardant standards of European furniture en 597-1 and en 597-2 the same?
猜你喜欢
随机推荐
《性能之巅第2版》阅读笔记(二)--CPU监测
MSc 307 (88) (2010 FTPC code) Part 9 bedding test
基于正点原子stm32的mini板的TFTLCD显示实验
Zipkin service link tracking
English语法_形容词/副词3级-比较级_常用短语
leetcode:单调栈结构(进阶)
How to write anti shake throttling for small programs?
PyCharm设置仿sublime配色方案
Open the field of maker education and creation
ambari SSLError: Failed to connect. Please check openssl library versions.
用一个栈实现另一个栈的排序
从零到一,教你搭建「以文搜图」搜索服务(一)
利用ELK 搭建日志分析系统(三)—— 安全认证
错排兼排列组合公式
Using elk to build a log analysis system (I) -- component introduction
PostgreSQL implements batch update, deletion and insertion
How the uni app automatically switches the requested address according to the environment
第一个.net core MVC项目
数字电路学习笔记(二)
几个重要的物理概念








