Assignment #4 - Algorithms and Abstract Data Types | CMPS 101, Assignments of Computer Science

Material Type: Assignment; Class: Algorithms and Abstract Data Types; Subject: Computer Science; University: University of California-Santa Cruz; Term: Unknown 2009;

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-pls
koofers-user-pls 🇺🇸

8 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMPS 101
Winter 2009 Homework Assignment 4
1. (3 Points)
Consider the function defined by the recurrence formula
)(nT
⎣⎦
+
<
=3)3/(2
316
)( nnnT
n
nT
a. (1 Point) Use the iteration method to write a summation formula for .
)(nT
b. (1 Point) Use the summation in (a) to show that )()( nOnT
=
c. (1 Point) Use the Master Theorem to show that )()( nnT
Θ
=
2. (6 Points)
Use the Master theorem to find asymptotic solutions to the following recurrences.
a. (1 Point)
nnTnT += )4/(7)(
b. (1 Point)
2
)3/(9)( nnTnT +=
c. (1 Point)
2
)5/(6)( nnTnT +=
d. (1 Point)
)log()5/(6)( nnnTnT +=
e. (1 Point)
2
)2/(7)( nnTnT +=
f. (1 Point) (Note: your answer will depend on the parameter a.)
2
)4/()( nnaSnS +=
3. (1 Point) p.75: 4.3-2
The recurrence describes the running time of an algorithm A. A competing
algorithm B has a running time of . What is the largest integer value for a such
that B is asymptotically faster than A ?
2
)2/(7)( nnTnT +=
2
)4/()( nnaSnS +=
4. (1 Points)
Let G be an acyclic graph with n vertices, m edges, and k connected components. Show that
. (Hint: use the fact that
knm = 1|)(||)(|
=
TVTE for any tree T, from the induction handout.)
5. (1 Point) (Appendix B.4 problem 3)
Show that any connected graph G satisfies 1)()( GVGE . (Hint: use induction on the number
of vertices.)
6. (1 Point) p. 538: 22.2-2
Show the d and
π
values that result from running breadth-first search on the undirected graph of
Figure 22.3, using vertex u as the source.
r s t u
v w x y
1

Partial preview of the text

Download Assignment #4 - Algorithms and Abstract Data Types | CMPS 101 and more Assignments Computer Science in PDF only on Docsity!

CMPS 101

Winter 2009 Homework Assignment 4

  1. (3 Points)

Consider the function T ( n )defined by the recurrence formula

⎩^ ⎣^ ⎦

T n n n

n T n

a. (1 Point) Use the iteration method to write a summation formula for T ( n ).

b. (1 Point) Use the summation in (a) to show that T ( n )= O ( n )

c. (1 Point) Use the Master Theorem to show that T ( n )=Θ( n )

  1. (6 Points)

Use the Master theorem to find asymptotic solutions to the following recurrences.

a. (1 Point) T ( n )= 7 T ( n / 4 )+ n

b. (1 Point)

2 T ( n )= 9 T ( n / 3 )+ n

c. (1 Point)

2 T ( n )= 6 T ( n / 5 )+ n

d. (1 Point) T ( n )= 6 T ( n / 5 )+ n log( n )

e. (1 Point)

2 T ( n )= 7 T ( n / 2 )+ n

f. (1 Point) (Note: your answer will depend on the parameter a .)

2 S ( n )= aS ( n / 4 )+ n

  1. (1 Point) p.75: 4.3-

The recurrence describes the running time of an algorithm A. A competing

algorithm B has a running time of. What is the largest integer value for a such

that B is asymptotically faster than A?

2 T ( n )= 7 T ( n / 2 )+ n 2 S ( n )= aS ( n / 4 )+ n

  1. (1 Points)

Let G be an acyclic graph with n vertices, m edges, and k connected components. Show that

m = nk. (Hint: use the fact that| E ( T )|= | V ( T )|− 1 for any tree T , from the induction handout.)

  1. (1 Point) (Appendix B.4 problem 3)

Show that any connected graph G satisfies E ( G ) ≥ V ( G ) − 1. (Hint: use induction on the number

of vertices.)

  1. (1 Point) p. 538: 22.2-

Show the d and π values that result from running breadth-first search on the undirected graph of

Figure 22.3, using vertex u as the source.

r s t u

v w x y

1