Questions tagged [heap]
A heap is a tree-based data structure that satisfies the heap property. For questions about memory allocated from the system heap, use the [memory-management] tag.
162 questions
7 votes
4 answers
552 views
Traversal Heap Sort (No Extractions)
I developed a heap sort variant that sorts a heap through traversal. Unlike in the standard heap sort, the algorithm does not remove the min element from the heap instead it traverses all the nodes of ...
4 votes
2 answers
317 views
C++ heap allocator using an explicit free list
Description I've written a heap allocator in C++ using an explicit free list for organization. I've also written a series of unit tests and a microbenchmark using Catch2. At time of writing I've ...
15 votes
5 answers
4k views
Max-heap implementation in C
I have tried to implement my Heap in C. The following are the 13 operations defined: build_maxheap insert exctract_max (delete heap max root) max_delete (delete an element or key) max_heapify clear ...
5 votes
1 answer
108 views
Bidirectional Dijkstra d-ary heap
This is my very first data structure written in Perl for a d-ary heap: ...
5 votes
2 answers
744 views
Binary Heap Structure Class C++
I wrote a binary heap structure class in C++. It is a templated class with a comparison type as one of the template parameters to allow for a min or max heap. I have not written anything in C++ in a ...
2 votes
1 answer
244 views
Sink algorithm in Max Heap Correctness
I am trying to determine the correctness of a helper method within my MaxHeap class. The goal of this helper method is, given the index of any node in the Max Heap, sink it to the correct level in the ...
8 votes
1 answer
500 views
Binary Heap Implementation in Rust
I'm learning Rust by implementing basic data structures and algorithms. I implemented a binary heap (max heap): ...
2 votes
1 answer
308 views
Priority Queue implementation for top k frequent elements leetcode in Ruby
While working on the following leetcode problem: https://leetcode.com/problems/top-k-frequent-elements/ I used a Priority Queu implementation in Ruby. I have learned how to implement a Priority Queu ...