Algorithms and data structures for JS/TS
  • Introduction
  • GETTING STARTED
    • TS
    • Node.js
    • ES Modules
    • Browsers
  • PUBLIC API
    • How to read
    • Linked lists
      • SinglyLinkedList
      • DoublyLinkedList
      • CircularlyLinkedList
    • Stacks and queues
      • LinkedStack
      • LinkedQueue
      • LinkedDeque
      • CircularQueue
      • CircularArrayBuffer
      • UnsortedPriorityQueue
      • SortedPriorityQueue
      • AdaptableHeapPriorityQueue
    • Maps
      • SortedMap
      • MaximaSet
      • AVLTreeMap
      • SplayTreeMap
      • RedBlackTreeMap
    • Trees
      • GeneralTree
      • LinkedBinaryTree
      • PreorderTreeTraversal
      • InorderTreeTraversal
      • PostorderTreeTraversal
      • EulerTourTreeTraversal
    • Searches
      • Binary search
      • Quick select
    • Text processing
      • Longest common subsequence
      • Boyer-Moore
      • Knuth-Morris-Pratt
    • Position
    • Locator
    • Comparators
  • CONTRIBUTION NOTES
    • How to contribute
    • Project structure
  • Changelog
Powered by GitBook
On this page

Was this helpful?

  1. PUBLIC API

Stacks and queues

Data structures with access limited to provide a specific way of interaction with their elements.

PreviousCircularlyLinkedListNextLinkedStack

Last updated 5 years ago

Was this helpful?

Import alias 'ads-js/queues'

This group contains data structures based on ordinary JavaScript as well as on from this package. Most of them are focused primarily on direct access to the stored elements without adapters akin . The only structure which still uses is .

Table of contents

- container of elements that are inserted and removed according to the LIFO principle. This structure is based on SinglyLinkedList.

- container of elements that are inserted and removed according to the FIFO principle. This structure is based on SinglyLinkedList.

- container of elements that are inserted and removed on either side. This structure is based on DoublyLinkedList.

- container of elements in which operations are performed based on FIFO principle and the last position is connected back to the first position to make a circle. This structure is based on CircularlyLinkedList.

- array-based implementation of circular FIFO data structure.

- container of elements which grants access to the least item stored in linear time and takes constant time for insertion. This structure is based on DoublyLinkedList.

- container of elements which grants access to the least item stored in constant time and takes linear time for insertion. This structure is based on DoublyLinkedList.

- container of elements which grants access to the least item stored in logarithmic time. Insertion operation has logarithmic complexity as well. This structure is based on binary heap and can afford constant time insertion if all queued elements are given in advance. It also allows to update elements after insertion and keeps itself sorted.

Arrays
linked lists
Position
Locators
AdaptableHeapPriorityQueue
LinkedStack
LinkedQueue
LinkedDeque
CircularQueue
CircularArrayBuffer
UnsortedPriorityQueue
SortedPriorityQueue
AdaptableHeapPriorityQueue