摘要:
const Compare ={ LESS_THAN:-1, BIGGER_THAN:1, EQUALS:0 } class Node{ constructor(key){ this.key = key; this.left = null; this.right = null; } } functi 阅读全文
摘要:
const Compare = { LESS_THAN: -1, BIGGER_THAN: 1, EQUALS: 0 }; function defaultCompare(a,b){ return a == b?Compare.EQUALS:(a<b)?Compare.LESS_THAN:Compa 阅读全文
摘要:
class ValuePair{ constructor(key,value){ this.key = key; this.value = value; } } function defaultToString(item){ if(item == null){ return 'null'; } if 阅读全文
摘要:
function defaultToString(item){ if(item == null){ return 'null'; } if(item == undefined){ return 'undefined'; } if(typeof item == "string" || item ins 阅读全文
摘要:
//因为每个键和每个键值对都设置为字符串类型,这样方便检索,所以需要写一个函数用来进行字符串转换 function defaultToString(item){ if(item == 'null'){ return 'null'; } if(item == 'undefined'){ return 阅读全文
摘要:
class Set{ constructor(){ this.items = {}; } has(element){ return Object.prototype.hasOwnProperty.call(this.items,element); } add(element){ if(!this.h 阅读全文
摘要:
class StackLInkedList{ constructor(){ this.items = new DoublyLinkedList();//https://www.cnblogs.com/MySweetheart/p/13212702.html } push(element){ this 阅读全文
摘要:
const Compare = { LESS_THAN:-1, BIGGER_THAN:1 }; function defaultCompare(a,b){ if(a b){ return 0; } return a < b?Compare.LESS_THAN : Compare.BIGGER_TH 阅读全文
摘要:
这个双端链表继承了单链表的一些属性,详情请见:https://www.cnblogs.com/MySweetheart/p/13212220.html 1.创建一个双端节点 class DoublyNode extends Node{ constructor(element,next,prev){ 阅读全文
摘要:
1.创建链表节点 class Node{ constructor(element,next){ this.element = element; this.next = next; } } 2.创建一个比较函数 function defaultEquals(a , b){ return a == b; 阅读全文