@woftis/linked-list

2.0.0 • Public • Published

Linked List

Methods

Methods Description
size Return the current list size
head Return the current head object
tail Return the tail (last) object
toString Return list of objects as a string in format ( value ) -> ( value ) -> ( value ) -> null
at(index) Return the object at a given index of the list
appendNode(value) Add a new item at the end of the list. Accepts the value of the node you want to add
prependNode(value) Add a new item at the start of the list (replacing the head). Accepts the value of the node you want to add
pop Remove the last item from the list
contains(value) Returns true if the list contains the passed value, else returns false
find(value) Returns the index number of the value if the list contains the passed value, else returns null
insertAt(index, value) Adds value to the specified index position of the list. If 0 is provided, it will prepend to the head, if index is greater than list size it will append to the tail
removeAt(index) Removes value from the specified index position of the list. If 0 is provided, it will remove the head, if index is greater than list size it will return null

Readme

Keywords

none

Package Sidebar

Install

npm i @woftis/linked-list

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

20.8 kB

Total Files

9

Last publish

Collaborators

  • woftis