上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: const Compare ={ LESS_THAN:-1, BIGGER_THAN:1, EQUALS:0 } class Node{ constructor(key){ this.key = key; this.left = null; this.right = null; } } functi 阅读全文
posted @ 2020-07-12 13:47 放学别跑啊 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-07-09 09:57 放学别跑啊 阅读(192) 评论(0) 推荐(0) 编辑
摘要: class ValuePair{ constructor(key,value){ this.key = key; this.value = value; } } function defaultToString(item){ if(item == null){ return 'null'; } if 阅读全文
posted @ 2020-07-07 14:15 放学别跑啊 阅读(214) 评论(0) 推荐(0) 编辑
摘要: function defaultToString(item){ if(item == null){ return 'null'; } if(item == undefined){ return 'undefined'; } if(typeof item == "string" || item ins 阅读全文
posted @ 2020-07-06 16:28 放学别跑啊 阅读(197) 评论(0) 推荐(0) 编辑
摘要: //因为每个键和每个键值对都设置为字符串类型,这样方便检索,所以需要写一个函数用来进行字符串转换 function defaultToString(item){ if(item == 'null'){ return 'null'; } if(item == 'undefined'){ return 阅读全文
posted @ 2020-07-03 10:46 放学别跑啊 阅读(549) 评论(0) 推荐(0) 编辑
摘要: class Set{ constructor(){ this.items = {}; } has(element){ return Object.prototype.hasOwnProperty.call(this.items,element); } add(element){ if(!this.h 阅读全文
posted @ 2020-07-02 11:30 放学别跑啊 阅读(221) 评论(0) 推荐(0) 编辑
摘要: class StackLInkedList{ constructor(){ this.items = new DoublyLinkedList();//https://www.cnblogs.com/MySweetheart/p/13212702.html } push(element){ this 阅读全文
posted @ 2020-07-01 09:20 放学别跑啊 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-07-01 08:16 放学别跑啊 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 这个双端链表继承了单链表的一些属性,详情请见:https://www.cnblogs.com/MySweetheart/p/13212220.html 1.创建一个双端节点 class DoublyNode extends Node{ constructor(element,next,prev){ 阅读全文
posted @ 2020-06-30 11:22 放学别跑啊 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1.创建链表节点 class Node{ constructor(element,next){ this.element = element; this.next = next; } } 2.创建一个比较函数 function defaultEquals(a , b){ return a == b; 阅读全文
posted @ 2020-06-30 10:15 放学别跑啊 阅读(247) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页