heap-typed
Advanced tools
Comparing version 1.19.9 to 1.20.0
{ | ||
"name": "heap-typed", | ||
"version": "1.19.9", | ||
"version": "1.20.0", | ||
"description": "Heap. Javascript & Typescript Data Structure.", | ||
@@ -60,5 +60,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"data-structure-typed": "^1.19.9", | ||
"data-structure-typed": "^1.20.0", | ||
"zod": "^3.22.2" | ||
} | ||
} |
@@ -24,3 +24,7 @@ # What | ||
``` | ||
### methods | ||
Min Heap | ||
![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/methods-8bit/min-heap.png?raw=true) | ||
Max Heap | ||
![](https://github.com/zrwusa/assets/blob/master/images/data-structure-typed/methods-8bit/max-heap.png?raw=true) | ||
### snippet | ||
@@ -36,10 +40,16 @@ | ||
minNumHeap.add(1).add(6).add(2).add(0).add(5).add(9); | ||
minNumHeap.poll() // 0 | ||
minNumHeap.poll() // 1 | ||
minNumHeap.peek() // 2 | ||
minNumHeap.toArray().length // 4 | ||
minNumHeap.toArray()[0] // 2 | ||
minNumHeap.toArray()[1] // 5 | ||
minNumHeap.toArray()[2] // 9 | ||
minNumHeap.toArray()[3] // 6 | ||
minNumHeap.has(1) // true | ||
minNumHeap.has(2) // true | ||
minNumHeap.poll() // 0 | ||
minNumHeap.poll() // 1 | ||
minNumHeap.peek() // 2 | ||
minNumHeap.has(1); // false | ||
minNumHeap.has(2); // true | ||
const arrFromHeap = minNumHeap.toArray(); | ||
arrFromHeap.length // 4 | ||
arrFromHeap[0] // 2 | ||
arrFromHeap[1] // 5 | ||
arrFromHeap[2] // 9 | ||
arrFromHeap[3] // 6 | ||
minNumHeap.sort() // [2, 5, 6, 9] | ||
@@ -89,10 +99,16 @@ | ||
minNumHeap.add(1).add(6).add(2).add(0).add(5).add(9); | ||
minNumHeap.poll() // 0 | ||
minNumHeap.poll() // 1 | ||
minNumHeap.peek() // 2 | ||
minNumHeap.toArray().length // 4 | ||
minNumHeap.toArray()[0] // 2 | ||
minNumHeap.toArray()[1] // 5 | ||
minNumHeap.toArray()[2] // 9 | ||
minNumHeap.toArray()[3] // 6 | ||
minNumHeap.has(1) // true | ||
minNumHeap.has(2) // true | ||
minNumHeap.poll() // 0 | ||
minNumHeap.poll() // 1 | ||
minNumHeap.peek() // 2 | ||
minNumHeap.has(1); // false | ||
minNumHeap.has(2); // true | ||
const arrFromHeap = minNumHeap.toArray(); | ||
arrFromHeap.length // 4 | ||
arrFromHeap[0] // 2 | ||
arrFromHeap[1] // 5 | ||
arrFromHeap[2] // 9 | ||
arrFromHeap[3] // 6 | ||
minNumHeap.sort() // [2, 5, 6, 9] | ||
@@ -99,0 +115,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42222
624
Updateddata-structure-typed@^1.20.0