{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Slide10 Trees

# Slide10 Trees - D iscrete Mathematics Discrete...

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

Discrete Mathematics Discrete Mathematics (2009 Spring) Trees (Chapter 10, 5 hours) Chih-Wei Yi Dept. of Computer Science National Chiao Tung University June 1, 2009

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

View Full Document
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees What°s Trees? A tree is a connected undirected graph with no simple circuits. Theorem An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees Rooted Trees A rooted tree is a tree in which one vertex has been designated as the root and every edge is directed away from the root. d f e c g b a e a b g f d c a e f g b c d

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

View Full Document
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees Terminologies of Rooted Trees If v is a vertex in T other than the root, the parent of v is the unique vertex u such that there is a directed edge from u to v . If u is the parent of v , v is called a child of u . Vertices with the same parent are called siblings . a b c d g h i k l m e f j
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees Terminologies of Rooted Trees (Cont.) The ancestors of a vertex other than the root are the vertices in the path from the root to this vertex, excluding the vertex itself and including the root. The descendants of a vertex v are those vertices that have v as an ancestor. A vertex of a tree is called a leaf if it has no children. Vertices that have children are called internal vertices . If a is a vertex in a tree, the subtree with a as its root is the subgraph of the tree consisting of a and its descendants and all edges incident to these descendants.

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

View Full Document
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees m-Ary Trees A root tree is called an m-ary tree if every internal vertex has no more than m children. The tree is called a full m-ary tree if every internal vertex has exactly m children. An m -ary tree with m = 2 is called a binary tree . An ordered rooted tree is a rooted tree where the children of each internal vertex are ordered. Ordered rooted trees are drawn so that the children of each internal vertex are shown in order from left to right. In an ordered binary tree (usually called just a binary tree), if an internal vertex has two children, the ±rst child is called the left child and the second child is called the right child . The tree rooted at the left child (or right child, resp.) of a vertex is called the left subtree (or right subtree , resp.) of this vertex.
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees Properties of Trees Theorem A tree with n vertices has n ° 1 edges. Theorem A full m-ary tree with i internal vertices contains n = mi + 1 vertices.

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

View Full Document
Discrete Mathematics Chapter 10 Trees §10.1 Introduction to Trees Properties of Trees (Cont.) Theorem A full m-ary tree with 1 n vertices has i = ( n ° 1 ) / m internal vertices and l = [( m ° 1 ) n + 1 ] / m leaves, 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}