Giter Club home page Giter Club logo

parrot-dll's Introduction

parrot-sll

A doubly linked list in JavaScript.

Usage

const ParrotDll = require("parrot-dll");

const addressList = ParrotDll();
addressList.add({ name: 'Bruce Lee', street: 'Kung Fu Street 12' });
addressList.add({ name: 'John Snow', street: 'Winterfell 1' });

console.log(addressList.size()) // "2"

console.log(addressList.get(0).name) // "Bruce Lee"
console.log(addressList.get(1).name) // "John Snow"

addressList.remove(0);

console.log(addressList.size()) // "1"

console.log(addressList.get(0).name) // "John Snow"

Methods

  • add(object: any): void Adds an object to the list
  • size(): number Returns the size of the list
  • get(index: integer): any Returns object at given index. If index is out of bounds it returns null.
  • remove(index: integer): any Removes the object at given index from the list and returns the removed object. If the index is out of bounds it returns null.

Runtime complexity

  • add: O(1)
  • size: O(1)
  • get: O(n)
  • remove: O(n)

parrot-dll's People

Contributors

annoraaq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.