Questions tagged [fibonacci-heap]

A Fibonacci heap is an implementation of a priority queue that supports amortized O(1) insertion, merge, find-min, and decrease-key, along with amortized O(log n) delete and extract-min. When implemented with a Fibonacci heap, Dijkstra's algorithm and Prim's algorithm can be made to work in O(E + V log V).

74 questions
1
vote
1 answer

CLRS's Fibonacci Heap size(x) analysis has a flaw?

In CLRS's Introduction to Algorithms 3rd edition P.525, when it analyzes the size(x)'s lower bound, there is a sentence that I quote as "because adding children to a node cannot decrease the node’s size, the value of Sk increases monotonically with…
jscoot
  • 1,899
  • 3
  • 22
  • 27
1
vote
2 answers

Pell heap,just like Fibonacci heap

Is there any heap based on Pell sequence(or Pell number) instead of Fibonacci number(like the Fibonacci heap)?
huyichen
  • 113
  • 1
  • 4
1
vote
1 answer

Computing directly nth Fibonacci term without finding previous terms using binet's formula. (in O(1) time)

from math import sqrt n = int(input()) phi = (1 + sqrt(5))/2 fib_n = round((phi**n)) print(fib_n) The above-mentioned code is not correct, it gives some nearer value to fib_n. from math import sqrt n = int(input()) phi = (1 + sqrt(5))/2 fib_n…
hack3r_0m
  • 543
  • 3
  • 15
1
vote
1 answer

Min Fibonacci Heap - How to implement increase-key operation?

I have been trying to implementing heap data structures for use in my research work. As part of that, I am trying to implement increase-key operations for min-heaps. I know that min-heaps generally support decrease-key. I was able to write the…
1
vote
1 answer

Original design of DecreaseKey of Fibonacci heaps in Fredman and Tarjan's paper

I am now implementing the Fibonacci heap according to the original Paper of Fredman and Tarjan. If I understand it correctly, according to the paper, to perform the DecreseKey operation of a node x, we simply cut it from its parent. But if the key…
Snjór
  • 61
  • 6
1
vote
1 answer

Using Existing Fibonacci Heap Java Implementation with Dijkstra's Shortest Path Java Implementation

Using java programming language, I am trying to implement the most efficient shortest path algorithm on a graph with positive edge cost. To the best of my knowledge, that would be Dijkstra's algorithm with a Fibonacci Heap as the priority Queue. I…
Traveling Salesman
  • 1,901
  • 8
  • 36
  • 66
1
vote
1 answer

Decrease operation in fibonacci heap, boost

I'm trying to use in my implementation the fibonacci heap from boost but my program crashes, when I calling decrease function, this the example (W is a simple class): struct heap_data { boost::heap::fibonacci_heap::handle_type…
Vincenty
  • 11
  • 2
1
vote
0 answers

Dijkstra with fibonacci heap

I am trying to implement Dijkstra's algorithm for finding the shortest paths between nodes using Fibonacci Heap with Adjacency List representation for the graph. According to the algorithm I know, we have to find the minimum node in the Heap and…
LoL
  • 21
  • 4
1
vote
2 answers

How to improve Boost Fibonacci Heap performance

I am implementing the Fast Marching algorithm, which is some kind of continuous Dijkstra. As I read in many papers, the Fibonacci heap is the most adequate heap for this purpose. However, when profiling with callgrind my code I see that the…
Javi
  • 2,934
  • 4
  • 23
  • 38
1
vote
1 answer

Why does Fibonacci heap keep a global node counter?

I read that Fibonacci heap keeps a global node counter, but I can't see why. I even found an implementation that had the counter but didn't use it at all.
user267817
1
vote
1 answer

How to implement decrease-key in a Fibonacci heap to run in O(1) amortized time?

How can you get O(1) amortized complexity in the decrease-key operation on a Fibonacci heap? Just finding the node in the Fibonacci heap that contains the element takes O(n) time using a BFS, which should make it impossible to get O(1) amortized…
1
vote
1 answer

Promote a node after already lost 2 or more children

In the decrease-key operation of a Fibonacci Heap, if it is allowed to lose s > 1 children before cutting a node and melding it to the root list (promote the node), does this alter the overall runtime complexity? I think there are no changes in the…
1
vote
1 answer

Implementing Consolidate in Fibonacci heap

The pseudocode from Introduction to Algorithms states: for each node w in the root list of H link trees of the same degree But how to efficiently implement the for each root node part? Original roots are linked to other roots of the same degree…
kenor
  • 1,797
  • 1
  • 15
  • 27
1
vote
1 answer

How to show Fibonacci heap with n nodes can have height n?

I want to show that a Fibonacci heap with n nodes could have height n. I tried this with examples but I don't know how to show this in general.
Rat565
  • 83
  • 2
  • 4
1
vote
1 answer

Fibonacci heaps: Insertion, Extract-Min, and Performance?

I was trying to learn about fibonacci heaps, the pseudocode for inserting an element in the heap was: Fibonacci-Heap-Insert(H,x) degree[x] := 0 p[x] := NIL child[x] := NIL left[x] := x right[x] := x mark[x] := FALSE concatenate the root list…
2147483647
  • 1,107
  • 3
  • 12
  • 29