摘要:
代码如下: function palidromeChecker(aString){ if(aString undefined || aString null || (aString != null && aString.length == 0)){ return false; } const deq 阅读全文
摘要:
这个击鼓传花基于普通的队列级基础上变为循环队列,没有使用双端队列,普通的队列可以见我之前发布的文章。击鼓传花代码如下: function hotPotato(elementsList,num){ const queue = new Queue();//这个队列类,可以参考https://www.cn 阅读全文
摘要:
1.双端队列,一种允许我们从队列的前面和后面添加和删除元素的队列。 2.创建一个双端队列的类 class Deque{ constructor(){ this.lowestCount = 0; this.count = 0; this.items = {}; } } 3.判断队列是否为空 isEmp 阅读全文
摘要:
1.队列是遵循先进先出(FIFO)原则的一组有序的项,队列在尾部添加元素,并从顶部移除元素,最新添加的元素必须排在队列的末尾。生活中常见的例子如排队等。 2.创建一个队列类 class Queue{ constructor(){ this.count = 0;//记录队列的数量 this.lowes 阅读全文