Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

xzripper/DHeap

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
4 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

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.