Skip to content
/ DHeap Public

More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.

License

Notifications You must be signed in to change notification settings

xzripper/DHeap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

DHeap

More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.

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... */ }

About

More stable and modern alternative to D's BinaryHeap, with small performance trade-offs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages