https://github.com/xzripper/dheap
More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.
https://github.com/xzripper/dheap
binaryheap binaryheap-array d heap heapq modernized utility
Last synced: 2 months ago
JSON representation
More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.
- Host: GitHub
- URL: https://github.com/xzripper/dheap
- Owner: xzripper
- License: mit
- Created: 2025-03-19T01:31:40.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-19T01:46:40.000Z (3 months ago)
- Last Synced: 2025-03-19T02:32:50.494Z (3 months ago)
- Topics: binaryheap, binaryheap-array, d, heap, heapq, modernized, utility
- Language: D
- Homepage: https://github.com/xzripper/DHeap
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DHeap
More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.```d
import DHeap.Heap;Heap!int heap = Heap!int([1, 3, 2, 4, 6, 5, 7, 9, 8, 10], HeapType.MIN_HEAP); // MinHeap initialized. Values are automatically heapified.
heap.HeapPush(0); // Push zero to the heap. Automatically sifts the heap.
heap.HeapFront(); // Get heap front object. Returns zero as long as we have MIN_HEAP as a heap type.
heap.HeapPop(); // Pop the front object of the heap. Returns the front object before popping the object. Returns 0.
heap.Empty(); // Or heap.Empty (works as a @property). Check is the heap empty.
heap.Size(); // Or heap.Size (works as a @property). Get the heap size/length.// Iterable via foreach!
foreach(int num; heap) { /** Some work to do... */ }
```