Assignment 9 Problems - Data Structure and Algorithms | CS 245, Assignments of Data Structures and Algorithms

Material Type: Assignment; Class: Data Struct & Algorithms; Subject: Computer Science; University: University of San Francisco (CA); Term: Spring 2005;

Typology: Assignments

Pre 2010

Uploaded on 07/30/2009

koofers-user-lpj
koofers-user-lpj 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Data Structures and Algorithms
Homework Assignment 9
Due Monday, April 25, 2005
1. In class we stated the following result: Suppose Gis a connected, undirected graph with n
vertices. If the number of edges in Gis n1,then Gis a free tree.
First note that the result can be proved by drawing the different cases if Ghas 1 or 2 vertices.
So we may as well assume that n3.
Since a free tree is a connected graph with no simple cycles, one way to prove this is to look
at the contrapositive: Suppose Gis a connected, undirected graph with n3 vertices. If G
contains a simple cycle, then the number of edges in Gis at least n.
In order to prove this, we take a connected graph Gcontaining a simple cycle Con kvertices.
As noted in the text, the smallest simple cycle has 3 vertices. So k3.Now we can use
induction on the number mof vertices in the complement of C, and k, the number of vertices
in C, is fixed.
(a) Prove the base case. That is, show that if Gis a connected graph with k3 vertices
and Gcontains a simple cycle on all kvertices, then Gcontains at least kedges. Hint:
Count the edges in a simple cycle.
(b) State the induction hypothesis.
(c) What do you need to show in the induction step? What are you assuming? What do
you need to prove?
(d) Extra Credit. Complete the induction step. Hint: in going from the case m=m0+ 1
vertices in the complement of Cto the case m=m0vertices in the complement of C,
use a DFS of G. The DFS should visit the vertices in Cfirst. Then the vertex that needs
to be deleted can be chosen to be a leaf in the depth-first spanning tree.
2. Problem 7.13, page 221.
3. Problem 7.17, page 222.
4. Problem 7.23, page 222.
1

Partial preview of the text

Download Assignment 9 Problems - Data Structure and Algorithms | CS 245 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Data Structures and Algorithms

Homework Assignment 9

Due Monday, April 25, 2005

  1. In class we stated the following result: Suppose G is a connected, undirected graph with n vertices. If the number of edges in G is n − 1 , then G is a free tree. First note that the result can be proved by drawing the different cases if G has 1 or 2 vertices. So we may as well assume that n ≥ 3. Since a free tree is a connected graph with no simple cycles, one way to prove this is to look at the contrapositive: Suppose G is a connected, undirected graph with n ≥ 3 vertices. If G contains a simple cycle, then the number of edges in G is at least n. In order to prove this, we take a connected graph G containing a simple cycle C on k vertices. As noted in the text, the smallest simple cycle has 3 vertices. So k ≥ 3. Now we can use induction on the number m of vertices in the complement of C, and k, the number of vertices in C, is fixed.

(a) Prove the base case. That is, show that if G is a connected graph with k ≥ 3 vertices and G contains a simple cycle on all k vertices, then G contains at least k edges. Hint: Count the edges in a simple cycle. (b) State the induction hypothesis. (c) What do you need to show in the induction step? What are you assuming? What do you need to prove? (d) Extra Credit. Complete the induction step. Hint: in going from the case m = m 0 + 1 vertices in the complement of C to the case m = m 0 vertices in the complement of C, use a DFS of G. The DFS should visit the vertices in C first. Then the vertex that needs to be deleted can be chosen to be a leaf in the depth-first spanning tree.

  1. Problem 7.13, page 221.
  2. Problem 7.17, page 222.
  3. Problem 7.23, page 222.