Stacks and queues
Data structures with access limited to provide a specific way of interaction with their elements.
Last updated
Was this helpful?
Data structures with access limited to provide a specific way of interaction with their elements.
Last updated
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 .
- 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.