1.0.0 • Published 4 years ago

@amirho/deque v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Deque Data Structure

In computer science, a double-ended queue (abbreviated to deque, pronounced deck, like "cheque"1) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front (head) or back (tail).2 It is also often called a head-tail linked list, though properly this refers to a specific data structure implementation of a deque (see below).In computer science, a double-ended queue (abbreviated to deque, pronounced deck, like "cheque"1) is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front (head) or back (tail).2 It is also often called a head-tail linked list, though properly this refers to a specific data structure implementation of a deque (see below).

Wikipedia

Table of Content

  1. Usage
  2. License
  3. Author

Usage

npm i @amirho/deque

import and use it simple

import Deque from "@amirho/Deque";

const deque = new Deque();

deque.isEmpty(); // true

deque.addFront("javascript");

deque.isEmpty(); // false

deque.size; // 1

deque.removeFront(); // returns javascript

deque.addBack("vue");
deque.addBack("react");

deque.removeBack(); //returns react

deque.clear(); // removes all element

deque.size; // 0

you can test it also

npm test

license

MIT

Author

AmirHossein Salighedar

1.0.0

4 years ago