当前位置:网站首页>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
边栏推荐
猜你喜欢

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

@Several scenarios of transactional failure

A preliminary study of blackbody radiation

使用信号分析器

ambari SSLError: Failed to connect. Please check openssl library versions.

加法器—笔记

电学基础知识整理(一)

小程序image组件不显示图片?

Iso8191 test is mentioned in as 3744.1. Are the two tests the same?

第一章 Bash 入门
随机推荐
ambari SSLError: Failed to connect. Please check openssl library versions.
ERP升级的另一种选择,MES系统
Supplementary questions of monthly competition
MSc 307 (88) (2010 FTPC code) Part 9 bedding test
MSc 307 (88) (2010 FTPC code) Part 5 low flame spread test
English grammar_ Adjective / adverb Level 3 - Comparative_ Useful Expressions
Does the applet input box flash?
2021年终总结及2022年展望
《性能之巅第2版》阅读笔记(二)--性能观察工具
leetcode:单调栈结构(进阶)
月赛补题
02 MongoDB数据类型、重要概念以及shell常用指令
Cannot edit in read-only editor if it appears in vscode
一文告诉你什么是 Kubernetes
Understanding and learning of parental delegation mechanism
关于 SY8120I 的DC-DC的降压芯片的学习(12V降至3.3V)
多项目设计开发·类库项目引入入门
How to apply for ASTM E108 flame retardant test for photovoltaic panels?
第一个.net core MVC项目
音频 scipy 中 spectrogram 的运作机制