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

Request fix "at" method in Queue #84

Closed vadymsushkovdev closed 7 months ago

vadymsushkovdev commented 7 months ago

Since you use "offset" in the shift method for optimization purposes, accessing a variable by index in the "at" method should also take into account the variable's position relative to the offset.

Path: "data-structure-typed/src/data-structures/queue/queue.ts".

Fix:

  at(index: number): E | undefined {
    return this.elements[index + this._offset];
  }
zrwusa commented 7 months ago

This issue has been resolved in version 1.52.0