Assignment 11 -- Due Monday, November 22
(at the beginning of lab)
CS 4521 Fall Semester, 2010
Topic: Implementation of Fibonacci Heaps
consists of two parts:
Part 1: (15 points) Implementation of Fibonacci Heaps.
Part 2: (5 points) Fibonacci Heap exercises.
For Part 2, write code and that implements Fibonacci heap operations as
described in Chapter 19 of the text. Implementing Fibonacci heaps will
require coding the operations:
Much of the code is provided for you. You need to supply code for
FIB-HEAP-EXTRACT-MIN - consolidate() in particular.
- MAKE-FIB-HEAP (a constructor in C++)
- FIB-HEAP-UNION (not required - extra credit)
You can use a modified version of the command interpreter
for binary heaps (in Assignment 4); as in that assignment,
insert, return the minimum key value, and extract the minimum.
Also, a routine to show the structure of your Fibonacci heap is supplied
The test files are the same as for binary heaps. The correct output
for heaptest1 is at:
Here is a
.h file for the Fibonacci Heap (FibHeap) class
and skeleton code for the BHeap class implementation
Here is a command interpreter:
Here is a "Makefile" that puts it all together:
When you download these files, be sure to remove the ".txt" suffixes
(by moving them to the same file name without the ".txt").
What To Hand In
Hand in a copy of your code and the output of the test files
Identify them clearly and draw in the links between nodes printed by
the ShowHeap() operation.
Also hand in the following:
- Exercise 19.2-1 (4 points), page 518.
- Read Problem 19-2 pages 527-529, then write a statement saying
"I have read Problem 19-2." on the homework you turn in (1 point).
Extra Credit (up to 6 points)
Implement the union, decrease-key, and delete operations, and test them with
test files that show those operations work correctly. To do this, you
should also implement a search(k) operation that returns a pointer, x,
to the node with key k. Then to test decrease-key
in your command interpreter,
first search for the original key value k-orig with
search(k-orig) to get x, then call decrease-key(x, k-new) where k-new
is the decreased value of the key. Similarly, to test delete for
a node with
key value k, first search(k) to get x, and then call delete(x).
Page URL: http://www.d.umn.edu
Page Author: Doug Dunham
Last Modified: Friday, 03-Dec-2010 18:02:29 CST
Comments to: email@example.com