Some data structures implemented in Javascript 2015 (es6): Stack, LinkedList
npm install --save data-structures-es6
Getters
- head
- last
- length
Methods
- push
- pop
- clear
- isEmpty
- toString
var Stack = require("data-structures-es6").Stack
var stack = new Stack()
stack.push(1)
stack.push(2)
stack.pop()
stack.clear()Getters
- head
- tail
- length
- current
Methods
- resetCursor
- next
- push
- at
- removeAt
var LinkedList = require("data-structures-es6").LinkedList
var list = new LinkedList()
list.push(1)
list.push(2)
list.next()
var curentNode = list.current
console.log(curentNode.data) //2