摘要: 链表 -> 队列 class QueueByLinkList{ #head = null #tail = null #len = 0 add(value){ const newNode = { value, next: null } if(!this.#head){ this.#head = new 阅读全文
posted @ 2023-01-26 18:14 671_MrSix 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 数组生成单向链表 const createLinkList = (array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) => { let root = null; for (let index = 0; index < array.length; index++) { co 阅读全文
posted @ 2023-01-26 16:55 671_MrSix 阅读(9) 评论(0) 推荐(0) 编辑
摘要: #code class Queue { #stack1 = [] #stack2 = [] add(value){ this.#stack1.push(value) return this.#stack1.length } delete(){ while(this.#stack1.length){ 阅读全文
posted @ 2023-01-26 00:53 671_MrSix 阅读(8) 评论(0) 推荐(0) 编辑