Implementação de JavaScript de Lista Single Linked (LinkedList)
Bibliotecas relacionadas ao NPMJS:
lista complexa, lista inteligente, lista de ligações individuais
Idéias de programação:
Sua própria implementação:
Singlenode.js
(function () {"use strict"; function node (element) {this.element = element; this.next = null;} module.exports = node;}) ();LinkedList.js
(function () {"use strict"; var node = requer ("./ lib/singlenode"); função linkedList () {this._head = new node ("este é o nó da cabeça. function () {Retorne this._size; Linkedlist.protype.remove = função (item) {if (item) {var prenode = this.findPre (item); função (item) {this.insert (item); Finder.Next = NEWNODE; Retorno Currnode; NULL) Retorno NULL;Implementação de JavaScript de Doublelinkedlist
Bibliotecas relacionadas ao NPMJS:
Lista complexa, lista inteligente
Idéias de programação:
Sua própria implementação
Doublenode.js
(function () {"use strict"; function node (element) {this.element = element; this.next = null; this.previous = null;} module.exports = node;}) ();DoubleLinkedList.js
(function () {"use strict"; var node = requer ("./ lib/doublenode"); função dublelinkedlist () {this._head = new Node ("Este é o nó da cabeça."); this._size = 0;} DoubleLinked.Prototype.GeThead = function () {Return th This; Doublelinklist.Prototype.isempty = function () {return this._size === 0; CurrNode.Next; (Node.Next === NULL) {Node.Previous.Next = NULL; Doublelinkedlist.prototye.find = função (item) {if (item == null) Retorne nulo; = new Node(newElement); var finder = item ? this.find(item) : null; if(!finder){ var last = this.findLast(); newNode.previous = last; last.next = newNode; } else{ newNode.next = finder.next; newNode.previous = finder; finder.next.previous = newNode; finder.next = newNode; DoubleLinkedlist.prototype.display = function () {varrnode = this.gethead ().