Docsity

Mathematics for Computer Science Five Practice Problems, Exercises of Applied Mathematics

Toggle sidebar
bg1
6.042/18.062J Mathematics for Computer Science October 5, 2010
Tom Leighton and Marten van Dijk
Problem Set 5
Readings: Section 5.4 to 5.7 and 6.1-6.2.
Problem 1. [20 points] Recall that a tree is a connected acyclic graph. In particular, a
single vertex is a tree. We define a Splitting Binary Tree, or SBTree for short, as either the
lone vertex, or a tree with the following properties:
1. exactly one node of degree 2 (called the root).
2. every other node is of degree 3 or 1 (called internal nodes and leaves, respectively).
For the case of one single vertex (see above), that vertex is considered to be a leaf. It is
easier to understand the definition visually, so an example is shown in Figure 1. An example
of a tree which is not an SBTree is shown in Figure 2.
(a) [10 pts] Show if an SBTree has more than one vertex, then the induced subgraph ob-
tained by removing the unique root consists of two disconnected SBTrees. You may assume
that by removing the root you obtain two separate connected componenents, so all you need
to prove is that those two components are SBTrees.
(b) [10 pts] Prove that two SBTrees with the same number of leaves must also have the
same total number of nodes. Hint: As a conjecture, guess an expression for the total number
of nodes in terms of the number of leaves N (l). Then use induction to prove that it holds
for all trees with the same l
Problem 2. [20 points]
In ”Die Hard: The Afterlife”, the ghosts of Bruce and Sam have been sent by the evil Simon
on another mission to save midtown Manhattan. They have been told that there is a bomb
on a street corner that lies in Midtown Manhattan, which Simon defines as extending from
41st Street to 59th Street and from 3rd Avenue to 9th Avenue. Additionally, the code that
they need to defuse the bomb is on another street corner. Simon, in a good mood, also tosses
them two carrots:
�
He will have a helicopter initially lower them to the street corner where the bomb is.
pf3
pf4
pf5

Partial preview of the text

Download Mathematics for Computer Science Five Practice Problems and more Exercises Applied Mathematics in PDF only on Docsity!

6.042/18.062J Mathematics for Computer Science October 5, 2010

Tom Leighton and Marten van Dijk

Problem Set 5

Readings: Section 5.4 to 5.7 and 6.1-6.2.

Problem 1. [20 points] Recall that a tree is a connected acyclic graph. In particular, a

single vertex is a tree. We define a Splitting Binary Tree, or SBTree for short, as either the

lone vertex, or a tree with the following properties:

  1. exactly one node of degree 2 (called the root).
  2. every other node is of degree 3 or 1 (called internal nodes and leaves, respectively).

For the case of one single vertex (see above), that vertex is considered to be a leaf. It is

easier to understand the definition visually, so an example is shown in Figure 1. An example

of a tree which is not an SBTree is shown in Figure 2.

(a) [10 pts] Show if an SBTree has more than one vertex, then the induced subgraph ob

tained by removing the unique root consists of two disconnected SBTrees. You may assume

that by removing the root you obtain two separate connected componenents, so all you need

to prove is that those two components are SBTrees.

(b) [10 pts] Prove that two SBTrees with the same number of leaves must also have the

same total number of nodes. Hint: As a conjecture, guess an expression for the total number

of nodes in terms of the number of leaves N (l). Then use induction to prove that it holds

for all trees with the same l

Problem 2. [20 points]

In ”Die Hard: The Afterlife”, the ghosts of Bruce and Sam have been sent by the evil Simon

on another mission to save midtown Manhattan. They have been told that there is a bomb

on a street corner that lies in Midtown Manhattan, which Simon defines as extending from

41st Street to 59th Street and from 3rd Avenue to 9th Avenue. Additionally, the code that

they need to defuse the bomb is on another street corner. Simon, in a good mood, also tosses

them two carrots:

� He will have a helicopter initially lower them to the street corner where the bomb is.

A

E

F

D

B C

G

Figure 1: Splitting Binary Tree: Node A is the root, B and E are internal nodes, and C, D,

F, and G are leaves. Notice how all internal nodes have degree 3.

A

D E F

B C

Figure 2: This is an example of a tree which is NOT a Splitting Binary Tree. Notice how

both A and C have degree 2, when a BSTree can only have one such node.

(a) [7 pts] Find the error in the proof of the following claim.

Claim. Every non-empty, tangled graph is connected.

Proof. The proof is by strong induction on the number of vertices in the graph. Let P (n)

be the proposition that if an n-node graph is tangled, then it is connected. In the base case,

P (1) is true because the graph consisting of a single node is defined to be tangled and is

trivially connected.

In the inductive step, for n ≥ 1 assume P (1),... , P (n) to prove P (n + 1). That is, we want

to prove that if an (n + 1)-node graph is tangled, then it is connected. Let G be a tangled,

(n + 1)-node graph. Arbitrarily partition G into two pieces so that the first piece contains

exactly �

n 3

� vertices, and the second piece contains all remaining vertices. Note that since

n ≥ 1, the graph G has a least two vertices, and so both pieces contain at least one vertex.

By induction, each of these two pieces is connected. Since the graph G is tangled, there is

an edge leaving the first piece, joining it to the second piece. Therefore, the entire graph

is connected. This shows that P (1),... , P (n) imply P (n + 1), and the claim is proved by

strong induction.

(b) [5 pts] Draw a tangled graph that is not connected.

(c) [8 pts] An n-node graph is said to be mangled if there is an edge leaving every set of �

n 2

or fewer vertices. Again, as a special case, the graph consisting of a single node is considered

mangled. Prove the following claim. Hint: Prove by contradiction.

Claim. Every non-empty, mangled graph is connected.

Problem 4. [15 points]

(a) [5 pts] Suppose that G is a simple, connected graph on n nodes. Show that G has

exactly n − 1 edges iff G is a tree.

(b) [10 pts] Prove by induction that any connected graph has a spanning tree.

Problem 5. [15 points] The adjacency matrix of a graph is given below (Section 5.1.6 in

the book defines adjacency matrices)

(a) [4 pts] Draw the graph defined by this adjacency matrix. Label the vertices of your

graph 1 , 2 ,... , 6 so that vertex i corresponds to row and column i of the matrix.

(b) [4 pts] In a graph, we define the distance between to vertices to be the length of the

shortest path between them. We define the diameter of a graph to be the largest distance

between any two nodes. What is the diameter of this graph? Explain why.

(c) [3 pts] Find a cycle in this graph of maximum length and explain why it has maximum

length.

(d) [4 pts] Give a coloring of the vertices that uses the minimum number of colors. Prove

that this a minimum coloring.

Problem 6. [10 points] Let G be a graph. In this problem we show every vertex of odd

degree is connected to at least one other vertex of odd degree in G.

(a) [6 pts] Let v be an odd degree node. Consider the longest walk starting at v that does

not repeat any edges (though it may omit some). Let w be the final node of that walk. Show

that w = v.

(b) [4 pts] Show that w must also have odd degree.