34 Slides--Intro to Finite Automata

# 34 Slides--Intro to Finite Automata - CS103 HO#34...

This preview shows pages 1–3. Sign up to view the full content.

CS103 HO#34 Slides--Intorduction to Finite Automata April 30, 2010 1 CS103 4/30/10 Midterm Exam Review Sessions: Saturday, 4 – 7pm, Gates B12 Sunday, 4 – 7pm, Gates B12 (bring ID for entry) Exam: Tuesday, May 4, 7:00 – 9:00 pm Locations to be announced The exam is open book, open notes. You may not use computers or mobile devices. Mathematical Foundations of Computing Proving Things About Trees 1 2 3 4 5 6 7 Theorem: If T is a tree and x is one of its nodes other than the root, then the graph X consisting of x, its descendants, and the edges connecting them is a tree. 8 9 Proving Things About Trees 1 2 3 4 5 6 7 Theorem: If T is a tree and x is one of its nodes other than the root, then the graph X consisting of x, its descendants, and the edges connecting them is a tree. Proof: There is only one path from the root to x, so removing the edge in that path that is incident on x disconnects X from the original graph. If there is a cycle in X, then T is not a tree, and if X is not connected then T is not a tree. So X is acyclic and connected and thus a tree. 8 9 Proving Things About Trees 1 2 3 4 5 6 7 Theorem: A tree with n nodes has n – 1 edges. Proof: Every node in the tree except the root has a unique parent, and is connected to its parent by an edge. Every edge connects some node to its parent. There are n – 1 nodes with parents, so there are n – 1 edges. Alternate phrasings: |E| = |V| – 1 |V| = |E| + 1 8 9 Properties of Trees Let G = (V, E) be an undirected graph. The following statements are equivalent: 1. G is a tree. 2. Any two vertices of G are connected by a unique simple path. 3. G is connected, but if any edge in E is removed, the result is not connected. 4. G is connected, and |E| = |V| – 1. 5. G is acyclic, and |E| = |V| – 1. 6. G is acyclic, but if an edge is added to E, the resulting graph has a cycle. 1 2 3 4 5 6 7 1 2 3 4 5 6 7 Theorem: A tree with n nodes has n – 1 edges. Base Case: A tree with one node has no edges. Inductive Step: Assume that all trees with k 1 nodes have k – 1 edges, and consider a tree T with k + 1 nodes. Show that T has k edges. T must have a leaf since it is finite, connected, and acyclic. Let x be a leaf of T, and remove x and the edge connecting it to its parent. The remaining graph is still a tree and has k nodes. Thus by the I.H., it has k – 1 edges, and T has k edges. 8 9 Using Induction To Prove Things About Trees

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS103 HO#34 Slides--Intorduction to Finite Automata April 30, 2010 2 We often want to prove properties about some class of trees, or even all trees, and we can do this by structural induction. If it is difficult to identify a particular node to use in the argument, we proceed as follows. Base Case : Show that the property is true for a tree with one node. Inductive Step : For n 1, assume the property is true for all trees with m nodes where 1 m n, and consider a tree with n + 1 nodes.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

34 Slides--Intro to Finite Automata - CS103 HO#34...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online