Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robinmessage/fibonacci
A simple C++ fibonacci heap implementation
https://github.com/robinmessage/fibonacci
Last synced: 10 days ago
JSON representation
A simple C++ fibonacci heap implementation
- Host: GitHub
- URL: https://github.com/robinmessage/fibonacci
- Owner: robinmessage
- Created: 2010-11-03T12:04:23.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2019-05-14T09:10:59.000Z (over 5 years ago)
- Last Synced: 2024-08-02T12:22:45.162Z (3 months ago)
- Language: C++
- Homepage:
- Size: 44.9 KB
- Stars: 33
- Watchers: 5
- Forks: 17
- Open Issues: 3
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# Fibonacci Heap
This is a simple fibonacci heap, supporting the standard operations:
* Insert
* Merge
* Extract Minimum
* Decrease KeyWe also have a non-standard *find* function; this is only for testing and should not be used in production as finding in a heap is O(n).
Fibonacci heaps are slow and have significant storage overheads (4 pointers per node, plus an int and a bool for housekeeping.) They have a better complexity than binomial heaps only when you are doing significantly more merges or decrease key operations than extract minimum operations.
This implementation should show how Fibonacci heaps work; it is not intended to be highly performant.
## Sample output
The test program should produce a heap that looks like this:![A diagram of a heap produced by this program](https://github.com/robinmessage/fibonacci/raw/master/sample.png "Sample Fibonacci Heap")
Half-headed arrows are used for next and previous pointers. Full arrows are used for child and parent pointers. Filled arrowheads are used for next and child pointers; white arrowheads are for previous and parent pointers. Note that we synthesis child pointers to all the children of a node; in actuality, only one of these pointers is stored, since we can find sibling nodes. Marked nodes are grey and hoepfully the minimum is obvious.