lec13-recursive - tree with the root r Each T i is called a...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
EECS 203, Winter 2007 Discrete Mathematics Lecture 13 Recursive structures February 15 Reading: Rosen [4.3] February 15 Recursive structures, Page 1
Background image of page 1

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

View Full Document Right Arrow Icon
13.1 More inductions Critical steps in applying induction: The number to do induction on. Reduce k + 1 case to k case. Example. Suppose a m,n is defined as follows: a 0 , 0 = 0 , a m,n = a m - 1 ,n + 1 if n = 0 and m > 0 a m,n - 1 + n otherwise. Prove that a m,n = m + n ( n + 1) / 2 for all m, n N . Proof: Induction on m + n . February 15 Recursive structures, Page 2
Background image of page 2
13.2 Fibonacci numbers f 0 = 0, f 1 = 1, f n = f n - 1 + f n - 2 , n 2 . Proposition. f n = φ n - (1 - φ ) n 5 , where φ = 1+ 5 2 1 . 618 ... is the golden ratio. February 15 Recursive structures, Page 3
Background image of page 3

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

View Full Document Right Arrow Icon
13.3 Rooted trees A rooted tree is a tree with a vertex designated as the root and is defined recursively as follows: 1. A single vertex v is a rooted tree, with the root v . 2. If T 1 , ··· , T n are disjoint rooted trees with roots r 1 , ··· , r n , then the graph T formed by starting with an additional vertex r and adding an edge between r to r i , i = 1 ...n , is also a rooted
Background image of page 4
Background image of page 5

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

View Full Document Right Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tree with the root r . Each T i is called a subtree of T , and each r i is a child of r , and r is a parent of r i . A binary tree is a rooted tree of which each vertex has no more than 2 children. A full binary tree is a binary tree of which each vertex has either 0 or 2 children. The height h ( T ) of a rooted tree T is 1. 0 if T consists of a single vertex; February 15 Recursive structures, Page 4 13.3 Rooted trees 2. max { h ( T i ) : i = 1 ...n } + 1 if T 1 ...T n are subtrees of v . Fact. If T is a binary tree with n vertices, then n ≤ 2 h ( T )+1-1. February 15 Recursive structures, Page 5 13.4 Lower bound for sorting Theorem. Any sorting algorithm based on pair-wise comparisons must compare ≥ n log 2 n-cn times, for some constant c > 0 to sort n numbers. February 15 Recursive structures, Page 6...
View Full Document

{[ snackBarMessage ]}

Page1 / 6

lec13-recursive - tree with the root r Each T i is called a...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online