wi11dey / fast_heap

Provides a fast, mutable C++ priority_queue which mutates top() at double the speed of a naïve pop() + push()

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fast_heap

Provides a fast, mutable C++ priority_queue which mutates top() at double the speed of a naïve pop() + push().

Usage

Same as std::priority_queue, except for the addition of:

mutable_priority_queue::replace_top(const value_type& value)

Efficiently replaces the top of the heap with a copy of value using only one heapify-down operation.

mutable_priority_queue::replace_top(value_type&& value)

Efficiently replaces the top of the heap with rvalue value using only one heapify-down operation.

Examples

  • Merging k streams of sorted data into one sorted stream. Each element in the merged stream would take 2log(n) time to compute using the C++ STL; with this library you can acheive a constant-factor reduction of 2x.

About

Provides a fast, mutable C++ priority_queue which mutates top() at double the speed of a naïve pop() + push()

License:GNU Affero General Public License v3.0


Languages

Language:C++ 100.0%