摘要: 链表结构是无序的,可分为单链表和双链表这两种结构。 利用JS实现单链表: function ListNode(item) { this.item = item; this.next = null; } function LinkedList() { this.head = null; this.le 阅读全文
posted @ 2021-10-14 13:42 闯入码途的水产人 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 队列结构的特点是:一端进入,从另一端出去,可以总结为“先进先出”。 利用数组实现队列结构: function Queue(params) { this.items = []; } // 1、进入队列 Queue.prototype.enQueue = function (element) { thi 阅读全文
posted @ 2021-10-14 13:34 闯入码途的水产人 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 栈结构的特点是:“只能从栈的一端进入,先进后出”。 利用JS的数组来模拟栈结构: function Stack(params) { // this.items = []; } // 实现栈方法 // 1、入栈 Stack.prototype.push = function (element) { t 阅读全文
posted @ 2021-10-14 13:31 闯入码途的水产人 阅读(73) 评论(0) 推荐(0) 编辑