where is the Fibonacci Heap in STL ? and if STL do not implement Fibonacci Heap what is the best practice to implement it using existing algorithms and containers in STL ?
boost has an implementation of it. Hope that helps. There doesn't seem to be one in the STL. Here's an example:
for(int n=0;n<40;++n){
std::cout<<"F("<<n<<")="<<fibonacci(n)<<std::endl;
}
Even though it is not stated explicitly as a Fibonacci heap, the STL implements a priority_queue which has the same complexity and the same api and behavior as a Fibonacci heap (and may actually be a Fibonacci heap in disguise)
https://en.cppreference.com/w/cpp/container/priority_queue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With