views:

2284

answers:

3

I need a min-heap implemented as a binary tree. Really fast access to the minimum node and insertion sort.

Is there a good implementation in stl or boost that anyone can point me too?

+9  A: 

I think std::priority_queue is what you are looking for.

David Rodríguez - dribeas
Thanks Hank, I forgot to link it :)
David Rodríguez - dribeas
+5  A: 

See the Standard C++ algorithm make_heap().

anon
A: 

The STL doesn't have a concept of (binary) trees, but there are methods that facilitate in maintaining heap properties in a dataset, such as std::make_heap, std::sort_heap, std::push_heap et cetera.

Jasper Bekkers