# What is the use of fibonacci heaps

## Why are Fibonacci numbers important in computer science?

Fibonacci numbers have become a popular introduction to recursion for computer science students, and there is a strong case for them to persist in nature. For these reasons, many of us are familiar with them.

They also exist elsewhere in computer science; in surprisingly efficient data structures and algorithms based on the sequence.

There are two main examples that come to mind:

Is there a special property of these numbers that gives them an advantage over other numerical sequences? Is it a spatial quality? What other possible uses could they have?

It seems strange to me as there are a lot of natural number sequences that come up with other recursive problems, but I've never seen a Catalan bunch.

The Fibonacci numbers have all sorts of really nice math properties that make them excellent in computer science. Here are some:

1. They grow exponentially. One interesting data structure in which the Fibonacci series appears is the AVL tree, a form of the self-balancing binary tree. The intuition behind this tree is that each node maintains a balancing factor so that the heights of the left and right subtrees differ by at most one. Because of this, you can imagine that the minimum number of nodes required to get an AVL tree of height h is defined by a repetition that looks like this: N (h + 2) ~ = N (h) + N (h + 1), This looks very similar to the Fibonacci series. As you work out the math you can show that the number of nodes required to get an AVL tree of height h is F (h + 2) - 1. Since the Fibonacci series is growing exponentially, it means that the height of an AVL tree is at most logarithmic in the number of nodes, which gives you the O (lg n) search time we know and love about balanced binary trees. In fact, if you can associate the size of a structure with a Fibonacci number, you will likely get an O (lg n) run time in an operation. This is the real reason Fibonacci heaps are called Fibonacci heaps - proof that the number of heaps after a queue min is the limit of the number of nodes you can have at a given depth with a Fibonacci number includes.
2. Any number can be written as the sum of unique Fibonacci numbers. This property of the Fibonacci numbers is crucial for the Fibonacci search to work at all. If you couldn't add unique Fibonacci numbers to a possible number, this search wouldn't work. Compare this to many other series like 3 n or the Catalan numbers. This is also partly why many algorithms like powers of two I think.
3. The Fibonacci numbers can be calculated efficiently. The fact that the series can be generated extremely efficiently (you can get the first n terms in O (n) or any term in O (lg n)) then many of the algorithms they use would be impractical. Generating Catalan numbers is quite computationally intensive, IIRC. In addition, the Fibonacci numbers have a nice property that, given two consecutive Fibonacci numbers, for example F (k) and F (k + 1), we can easily calculate the next or previous Fibonacci number by considering the two values add (F (k) + F (k + 1) = F (k + 2)) or subtract (F (k + 1) - F (k) = F (k - 1)). This property is used in several algorithms in conjunction with property (2) to break down numbers into the sum of the Fibonacci numbers. For example, Fibonacci Search uses this to find values ββin memory.
4. They are educationally useful. Teaching recursion is difficult, and the Fibonacci series is a great way to introduce it. You can talk about direct recursion, memoization, or dynamic programming when introducing the series. In addition, the amazing closed form for the Fibonacci numbers is often taught as an induction or infinite series analysis, and the associated matrix equation for Fibonacci numbers is commonly introduced in linear algebra as a motivation for eigenvectors and eigenvalues. I think this is one of the reasons they are so well known in introductory courses.

I'm sure there are more reasons than just that, but I'm sure some of those reasons are the main factors. Hope that helps!

The greatest common factor is another magic; see this for too much magic. However, Fibonacci numbers are easy to calculate. it also has a specific name. For example, natural numbers 1,2,3,4,5 have too much logic; all prime numbers are in them; The sum of 1..n is calculable, everyone can produce with others, ... but nobody cares about them :)

One important thing that I forgot is the golden ratio which has very important implications in real life (for example, you like wide monitors :)

If you have an algorithm that can be successfully explained in a simple and concise way with understandable examples in CS and nature, what better teaching tool could anyone come up with?

Fibonacci sequences are indeed found everywhere in nature / in life. They are useful in modeling animal population growth, plant cell growth, snowflake shape, plant shape, cryptography, and of course, computer science. I've heard it's called nature's DNA pattern.

Fibonacci clusters have already been mentioned; The number of child nodes of each node in the heap is at most log (n). The subtree that starts a node with m children is also at least (m + 2) the Fibonacci number.

Torrent-like protocols that use a system of nodes and super-nodes use Fibonacci to decide when a new super-node is needed and how many sub-nodes it will manage. You perform node management based on the Fibonacci spiral (golden ratio). In the photo below you can see how nodes are split / merged (split from a large square into smaller ones and vice versa). See photo: http://smartpei.typepad.com/.a/6a00d83451db7969e20115704556bd970b-pi

Some occurrences in nature

http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/sneezewort.GIF

http://jwilson.coe.uga.edu/EMAT6680/Simmons/6690Pictures/pinecone3yellow.gif

http://2.bp.blogspot.com/-X5II-IhjXuU/TVbHrpmRnLI/AAAAAAAAABU/nv73Y9Ylkkw/s320/amazing_fun_featured_2561778790105101600S600x600Q85_20090723185630687jj

I don't think there is a definitive answer, but one possibility is that the operation to split a set S into two partitions S1 and S2, one of which is divided into sub-partitions S11 and S12, one of which is the same size like S2 ββ- is a likely approach for many algorithms and can sometimes be described numerically as a Fibonacci sequence.

Let me add another data structure to your data: Fibonacci trees. They are interesting because the computation of the next position in the tree can be done by simply adding the previous nodes:

It goes well with templatetypedef's discussion of AVL trees (an AVL tree can have a Fibonacci structure in the worst case). I've also seen buffers that in some cases have expanded in Fibonacci steps rather than powers of two.

Just to add a little something, Fibonacci numbers describe the breading of rabbits. They start with (1, 1), two rabbits, and then their population grows exponentially.

Its calculation as a power of the [[0,1], [1,1]] matrix can be regarded as the most primitive problem in operational research (similar to the prisoner's dilemma is the most primitive problem in game theory).

Symbols with frequencies that are consecutive Fibonacci numbers create Huffman trees of maximum depth. These trees correspond to source symbols encoded with binary codes of maximum length. Non-Fibonacci source symbol frequencies produce more balanced trees with shorter codes. The code length has a direct impact on the description complexity of the finite state machine, which is responsible for decoding a particular Huffman code.

Assumption: The 1st (Fib) image is compressed to 38 bits, while the 2nd (Uniform) is compressed to 50 bits. It seems that the closer your source symbol frequencies are to Fibonacci numbers, the shorter the final binary sequence, the better the compression, possibly optimal in the Huffman model.