Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
mc0080 set 1 july 2011

mc0080 set 1 july 2011

Ratings: (0)|Views: 182|Likes:
Published by killer1

More info:

Published by: killer1 on Dec 03, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





- 1 -
July 2011Master of Computer Application (MCA)
Semester 4MC0080
Analysis and Design of Algorithms
4 Credits(Book ID: B0891)Assignment Set
1Answer the following:Q1 . Describe the following:
Fibonacci Heaps
Binomial Heaps
Fibonacci Heaps
1) Structure of Fibonacci heaps
 Like a binomial heap, a
Fibonacci heap
is a collection of min-heap-ordered trees. The trees in aFibonacci heap are not constrained to be binomial trees, however. Figure (a) shows an example of a Fibonacci heap.Unlike trees within binomial heaps, which are ordered, trees within Fibonacci heaps are rooted
but unordered. As Figure (b) shows, each node
contains a pointer
 p [x]
to its parent and apointer child [x] to any one of its children. The children of 
are linked together in a circular,
doubly linked list, which we call the
child list
. Each child y in a child list has pointers
right [y]
that point to y‟s left and right siblings, respectively. If node y is an only child,
left [y] = right [y] = y
. The order in which siblings appear in a child list is arbitrary.
 - 2 -
Figure (a) A Fibonacci heap consisting of five min-heap-ordered trees and 14 nodes. Thedashed line indicates the root list. The minimum node of the heap is the node containing thekey 3. The three marked nodes are blackened. The potential of this particular Fibonacciheap is 5+2.3=11. (b) A more complete representation showing pointers p (up arrows), child(down arrows), and left and right (sideways arrows).
 Two other fields in each node will be of use. The number of children in the child list of node x isstored in degree[x]. The Boolean-valued field mark[x] indicates whether node
has lost a childsince the last time
was made the child of another node. Newly created nodes are unmarked, anda node x becomes unmarked whenever it is made the child of another node.A given Fibonacci heap H is accessed by a pointer
min [H]
to the root of a tree containing a
minimum key; this node is called the
minimum node
of the Fibonacci heap. If a Fibonacci heapH is empty, then
min [H] = NIL
.The roots of all the trees in a Fibonacci heap are linked together using their left and right pointers
into a circular, doubly linked list called the
root list
of the Fibonacci heap. The pointer
thus points to the node in the root list whose key is minimum. The order of the trees within aroot list is arbitrary.We rely on one other attribute for a Fibonacci heap H : the number of nodes currently in H is keptin n[H].
2) Potential function
 For a given Fibonacci heap H, we indicate by
t (H)
the number of trees in the root list of H andby
the number of marked nodes in
. The potential of Fibonacci heap
is then defined by(a)
For example, the potential of the Fibonacci heap shown in Figure 4.3 is
5+2.3 = 11. The potential of a set of Fibonacci heaps is the sum of the potentials of its constituent
- 3 -
Fibonacci heaps. We shall assume that a unit of potential can pay for a constant amount of work,where the constant is sufficiently large to cover the cost of any of the specific constant-timepieces of work that we might encounter.We assume that a Fibonacci heap application begins with no heaps. The initial potential,therefore, is 0, and by equation (a), the potential is nonnegative at all subsequent times.
3) Maximum degree
 The amortized analyses we shall perform in the remaining sections of this unit assume that there
is a known upper bound
on the maximum degree of any node in an n-node Fibonacci heap.
Binomial Heaps
A binomial heap
is a set of binomial trees that satisfies the following
binomial heapproperties.
 1. Each binomial tree in
obeys the
min-heap property:
the key of a node is greater than orequal to the key of its parent. We say that each such tree is
 2. For any nonnegative integer
, there is at most one binomial tree in
whose root has degree
.The first property tells us that the root of a min-heap-ordered tree contains the smallest key in thetree.The second property implies that an n-node binomial heap
consists of at most
[lg n] +
binomial trees. To see why, observe that the binary representation of n has
[lg n] + 1
bits,say , so that
. By property 1 of 4.4.2, therefore,binomial tree
appears in
if and only if bit
= 1
. Thus, binomial heap H contains at most
[lgn] + 1
binomial trees.
Q2 . If 
nn f 
then show that
gO f 
(i) For g = O (f), g (n) should be <= C. f (n) for all n >= k.When C = 53 and k = 3, we getg(n) <= C. f(n), which holds true.Therefore, g = O (f).(ii) For f not = to O (g), let us see the sample<= C.
 Now, let‟s imply, we get
 <= C. 174Further implying we get n < = 174 C for all n > = k.But for n = max {174 + 1, k}, the previous statement is not true.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->