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.

learn more… | top users | synonyms

0
votes
0answers
21 views

A functional binary heap implementation

I've implemented a binary heap in F#. It's pure and uses zippers for tree modification. To test it out I have implemented heap sort using it but it takes 10 seconds to sort a list of 100 000. Regular ...
4
votes
0answers
50 views

Scala heap implementation

I'm Scala beginner, so if anyone would be so kind and give some feedback. ...
5
votes
2answers
188 views

Map color problem: Optimize using a heap?

I've written some python code to solve the map coloring problem. In my code, I represent the problem using Territory and ...
6
votes
1answer
1k views

Implementation of binary heap in C++

Things I can think of include integer overflow, if the input type is int, etc. But other than that, what do you think is wrong with this code, design-wise, style-wise, and also in terms of other ...
4
votes
3answers
105 views

Time limit exceeded in Heap

I wrote a Heap, but the judge system reports "time limit exceeded" in some tests. I use a sift_down to build, so I don't know why. Maybe I can improve the build? ...
4
votes
2answers
873 views

Heap implementation using pointer

I know heaps are commonly implemented by an array. But, I wanted to share my pointer implementation and have your feedback(s) :) General idea: I convert the index to its binary value and then trace ...
5
votes
1answer
11k views

Implementation of Heap Sort

Is this the correct implementation of Heap Sort using Java? How can it be improved further? ...
6
votes
1answer
440 views

MaxHeap implementation

I'd like this to be reviewed: ...
0
votes
1answer
375 views

Heap memory preallocation (intended for games)

Currently, in my games, I'm using new and delete to create entities and components. It works fine, but there are slowdowns when ...
2
votes
1answer
326 views

Maxheap code review in Java

Just looking for some feedback on my implementation of a maxheap mostly relating to style. Trying to create good habits as i learn to program. Constructive criticism is appreciated! Thanks. Note: ...
3
votes
1answer
84 views

Tree heap Haskell code

I'd like a review of Haskell tree heap code in Turning a tree into a heap in Haskell. ...
3
votes
0answers
200 views

SGI STL pop_heap() method

Through the source code, I find SGI STL pop_heap() has three steps: put the root value into the last percolate down percolate up so pop an element at least ...
2
votes
1answer
1k views

Min Heap implementation with Dijkstra's algorithm

I am implementing Dijkstra's Algorithm using Min Heap to speed up the code. For a small number of nodes, the code is really running very fast. But for a large number of nodes, my code is throwing ...
2
votes
1answer
1k views

Fibonacci heap implementation

I'd like this reviewed. ...