1.0.2 • Published 10 years ago

all-structures v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

structures

A node based basic data structures library with type safety. Following data structures are currently supported.

  1. Array List
  2. Linked List
  3. Doubly Linked List

How to use

For example to create a LinkedList, use the following snippet:

ArrayList

An array list is a simple list data structure with an array implementation underneath. While creating an array list, following options are supported:

Supported Functions

  1. add()

    list.add("Hello")

  2. remove()

    list.remove(0);

  3. size()

    list.size();

  4. toString()

    list.toString();

  5. get()

    list.get(0);

LinkedList

A Linked list is a Singly LinkedList implementation While creating a linked list, following options are supported:

Supported Functions

  1. add()

    list.add("Hello")

  2. remove()

    list.remove(0);

  3. size()

    list.size();

  4. toString()

    list.toString();

  5. get()

    list.get(0);

  6. next() - gets the next node. Returns undefined if reached to end.

    list.next();

DoublyLinkedList

A doubly linked list can be traversed in both directions. While creating a doubly linked list, following options are supported:

Supported Functions

  1. add()

    list.add("Hello")

  2. remove()

    list.remove(0);

  3. size()

    list.size();

  4. toString()

    list.toString();

  5. get()

    list.get(0);

  6. next() - gets the next node. Returns undefined if reached to end.

    list.next();

  7. prev() - gets the previous node. Returns undefined if reached to start.

    list.prev();

Running Tests

Install dependencies

Run the mocha test cases