d-heap - Advanced Data Structures and Algorithms - Quiz, Exercises of Data Structures and Algorithms

Main points of this past exam are: Advanced Data Structures, Algorithms, Implement, D-Heap, General Greedy Method, Minimum Spanning Tree, Prim's Algorithm, Implicitly Colored, Approach, Efficient

Typology: Exercises

2012/2013

Uploaded on 03/23/2013

saruy
saruy ๐Ÿ‡ฎ๐Ÿ‡ณ

4.5

(120)

130 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
- 1 -
1. (4 points) The figure below shows the two arrays used to implement a d-heap for some
value of d. That is, h[x] is the item at position x in the heap and key[i] is the key for item i in
the heap.
Is this a valid heap for d=3? Why or why not?
Is it a valid heap for d=4? Why or why not?
CS 542 โ€“ Advanced Data Structures and Algorithms
Quiz 1
Jonathan Turner 1/25/2012
1
2
3
4
5
6
7
8
9
10
h
e
i
c
b
a
f
d
g
j
h
a
b
c
d
e
f
g
h
i
j
key
8
13
11
17
3
14
10
12
7
19
pf2

Partial preview of the text

Download d-heap - Advanced Data Structures and Algorithms - Quiz and more Exercises Data Structures and Algorithms in PDF only on Docsity!

  1. (4 points) The figure below shows the two arrays used to implement a d - heap for some value of d. That is, h [ x ] is the item at position x in the heap and key [ i ] is the key for item i in the heap. Is this a valid heap for d =3? Why or why not? Is it a valid heap for d =4? Why or why not?

CS 542 โ€“ Advanced Data Structures and Algorithms

Quiz 1

Jonathan Turner 1/25/

h e i c b a f d g j h

a b c d e f g h i j

key 8 13 11 17 3 14 10 12 7 19

  1. ( 6 points) State the red rule for the general greedy method for the minimum spanning tree problem. Primโ€™s algorithm effectively uses the blue rule alone until a tree has been formed, and then implicitly colors the remaining edges red. Suppose we had an MST algorithm that instead applied the red rule repeatedly until the remaining uncolored edges formed a tree and then implicitly colored these remaining edges blue. In a connected graph with n vertices and m edges, how many times would the red rule be applied? Which approach is more efficient for a dense graph (where m is much larger than n )?