zrwusa / data-structure-typed

Javascript Data Structure & TypeScript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree, AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack.
https://data-structure-typed-docs.vercel.app
MIT License
114 stars 8 forks source link

Max Length for Deque #89

Closed geyang closed 1 month ago

geyang commented 1 month ago

Is there a way to specify the maximum length for the Deque?

For instance, in python:


dq = dequeue(maxlen=10)

for i in range(20):
     dq.push(i)

assert len(dq) == 10, "length is capped at `maxlen`"
zrwusa commented 1 month ago

Is there a way to specify the maximum length for the Deque?

For instance, in python:

dq = dequeue(maxlen=10)

for i in range(20):
     dq.push(i)

assert len(dq) == 10, "length is capped at `maxlen`"

In response to your valuable feedback, we have incorporated a maxLen configuration parameter into the Deque implementation. To leverage this new functionality, kindly download the latest version, v1.52.1.