摘要:
// 基于数组封装一个栈 function Stack(){ this.items = []; // 压栈 Stack.prototype.push = function(element){ return this.items.push(element) } // 出栈 Stack.prototyp 阅读全文
摘要:
// 基于数组封装一个优先级队列 function PriorityQueue(){ this.items = []; // 创建一个内部类,用于存放元素的内容和优先级 function QueueElement(element,priority){ this.element = element; 阅读全文
摘要:
// 基于数组封装一个队列 function Queue() { this.items = []; // 将数据存入队列中 Queue.prototype.entryQueue = function (ele) { return this.items.push(ele) } // 数据出队列 Que 阅读全文