Algorithms
CSE5811
MidTerm
Fall2006
Points 40
Time 70 min
1.
Describe what does the following algorithm produce, and analyze its asymptotic time
complexity. [For analyzing complexity, presume
n
= 2
k
, for some positive integer
k
.]
Algorithm
Unknown
(rational
a
, positive int
n
)
If
n
= = 1
return
a
Else
If
n
%2 = = 0 then
Return
Unknown
(
a
,
n
/2)*
Unknown
(
a
,
n
/2)
Else
Return
a
*
Unknown
(
a
, (
n
1)/2)*
Unknown
(
a
, (
n
1)/2)
End algorithm.
2.
For a weighted undirected graph
G
a
culprit
set
C
of arcs has the following property: if
all the elements of
C
are removed from
G
it becomes acyclic (tree), and a
minculprit
set
M
of arcs is such that the aggregate weight of arcs in
M
is minimum for all such sets
C
.
Write a greedy algorithm to find
M
given a graph
G
.
[Hint: First try to find appropriate
G
–
M
.]
3a.
The following is a directed graph
G
: [
a: b
,
d
], [
b: c
], [
c: a
], [
d: e
], [
e: f
], [
f: d
], where
[
a: b
,
d
] means there is a directed arc in
G
from
a
to
b
and from
a
to
d
. Draw
G
.
You are to find the strong connected components (SCCs) of the graph by running the
relevant algorithm. Show (i) the first DFSspanning tree of
G
starting with the node
a
,
along with the postorder traversal numbers; (ii) the postorder traversal numbers shown
on the nodes of the reverse graph
G’
; and (iii) the second set of DFS spanning trees on
the reverse graph
G’
, which identifies the SCCs of
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '12
 Dmitra
 Algorithms, Dynamic Programming, dynamic programming algorithm

Click to edit the document details