https://github.com/tomusdrw/sortedlist
Fast priority queue implementation for JavaScript (fast: min/max, logarithmic: insert, contains)
https://github.com/tomusdrw/sortedlist
Last synced: 12 months ago
JSON representation
Fast priority queue implementation for JavaScript (fast: min/max, logarithmic: insert, contains)
- Host: GitHub
- URL: https://github.com/tomusdrw/sortedlist
- Owner: tomusdrw
- Created: 2011-12-02T21:58:56.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-10T16:17:45.000Z (over 14 years ago)
- Last Synced: 2024-10-16T08:49:44.038Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SortedList implementation for JavaScript based on array and mostly native array functions.
There is a possiblity to specify your own comparator - default comparator works well for Numbers and Strings.
Complexity of functions (without `splice` complexity):
* **peekMin/popMin** `O(1)`
* **peekMax/popMax** `O(1)`
* **size** `O(1)`
* **isEmpty** `O(1)`
* **pushAll(k)** `O(k*log(n))`
* **push** `O(log(n))`
* **contains** `O(log(n))`
* **remove** `O(log(n))`
* **getArray** `O(1)`