Implementasi JavaScript dari daftar tertaut tunggal (LinkedList)
Perpustakaan Terkait NPMJ:
daftar kompleks, daftar pintar, daftar singly-linked
Ide Pemrograman:
Implementasi Anda sendiri:
Singlenode.js
(function () {"Use strict"; function node (element) {this.element = elemen; this.next = null;} module.exports = node;}) ();LinkedList.js
(function () {"Gunakan ketat"; var node = membutuhkan ("./ lib/singlenode"); function linkedlist () {this._head = node new ("Ini adalah node head."); this._size = 0;} linkedlist.prototype.isempty = function () {return this._size === 0; linklist.prototype.isempty = function () {this.size ==== 0;} linklist.prototype.isempty = function () {this.size ==== 0; {===; function () {return this._size; Linkedlist.prototype.remove = function (item) {if (item) {var prenode = this.findpre (item) function (item) {this.insert (item); finder.Next = newNode;} this._size ++; Currnode; NULL) NULL;Implementasi JavaScript dari Doublelinkedlist
Perpustakaan Terkait NPMJ:
daftar kompleks, daftar pintar
Ide Pemrograman:
Implementasi Anda sendiri
Doublenode.js
(function () {"Use strict"; function node (element) {this.element = elemen; this.next = null; this.previous = null;} module.exports = node;}) ();Doublelinkedlist.js
(function () {"Gunakan ketat"; var node = membutuhkan ("./ lib/doublenode"); function doublelinkedlist () {this._head = node baru ("Ini adalah head node."); this._size = 0;} doublelinkedlist.prototype.gethead = {) {) {) {) {) {) {) {) {) {) {) {) {{) {) {) {) {) {) {) {) {) {) {) {) {) {) {) {) {) {) {) =) {return this._size === 0; Doublelinkedlist.prototype.add = Function (item) {if (item == null) NULL NULL; node.previous.Next = null; if (item == NULL) NULL; NULL; Doublelinkedlist.prototype.dispreverse = function () {var Currnode = this.findlast (); this.gethead (). Next;