CSE 321 Discrete Structures

Slides:



Advertisements
Similar presentations
Interval Heaps Complete binary tree. Each node (except possibly last one) has 2 elements. Last node has 1 or 2 elements. Let a and b be the elements in.
Advertisements

22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Recursive Definitions and Structural Induction
UCI ICS/Math 6A, Summer Recursion -1 after Strong Induction “Normal” Induction “Normal” Induction: If we prove.
CSE115/ENGR160 Discrete Mathematics 04/03/12 Ming-Hsuan Yang UC Merced 1.
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE115/ENGR160 Discrete Mathematics 03/31/11
Lecture Recursive Definitions. Fractals fractals are examples of images where the same elements is being recursively.
Lecture Recursive Definitions. Fractals fractals are examples of images where the same elements is being recursively.
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Induction and recursion
Recursive Definitions and Structural Induction
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Induction and recursion
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 4 Induction and Recursion 歐亞書局.
Chapter 4: Induction and Recursion
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction: Regular Expressions, Regular Languages Autumn 2011 CSE 3111.
Chapter 5 With Question/Answer Animations. Section 5.1.
4.3 Recursive Definitions and Structural Induction Sometimes it is difficult to define an object explicitly. However, it may be easy to define this object.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction Spring
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Recursive Data Structures and Grammars Themes –Recursive Description of Data Structures –Grammars and Parsing –Recursive Definitions of Properties of Data.
1 Recursive Definitions and Structural Induction CS 202 Epp section ??? Aaron Bloomfield.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
CSE 311: Foundations of Computing Fall 2013 Lecture 18: Structural induction, regular expressions.
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Spring
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Autumn 2012 CSE
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
CSE 311 Foundations of Computing I Lecture 18 Recursive Definitions: Context-Free Grammars and Languages Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 20 Context-Free Grammars and Languages Autumn 2012 CSE
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Recursive Definitions and Structural Induction ICS 6D Sandy Irani.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Chapter 4: Induction and Recursion
CS2210:0001Discrete Structures Induction and Recursion
Induction and Recursion
CSE 311 Foundations of Computing I
Recursively Defined Functions
Discrete Structures for Computer Science
Discrete Structures for Computer Science
CSE 311: Foundations of Computing
CSE 311 Foundations of Computing I
CSE 311: Foundations of Computing
CSE 311 Foundations of Computing I
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Section 9.3 by Andrew Watkins
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
321 Section, Feb. 14 Natalie Linnell.
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Depth of an AVL tree Theorem: Any AVL tree with n nodes has height less than log n. Proof: Given an n-node AVL tree, we want to find an upper bound.
Induction and recursion
CSE 321 Discrete Structures
Chapter 4 (Part 2): Mathematical Reasoning, Induction & Recursion
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
Presentation transcript:

CSE 321 Discrete Structures Winter 2008 Lecture 15 Structural Induction

Announcements Readings Today: Friday: Structural Induction Counting 6th edition: 4.3, 5th edition: 3.4, Friday: Counting 6th edition: 5.1, 5.2, 5th edition: 4.1, 4.2

Highlights from Lecture 14 Recursive Definitions Sets 0 S; if x  S then x+2  S Strings   L w  L, x  {a, b} then wxx  L Trees   EBT if T1, T2  EBT, then (, T1, T2)  EBT

Recursive Functions on Trees N(T) - number of vertices of T N() = 0; N() = 1 N(, T1, T2) = 1 + N(T1) + N(T2) Ht(T) – height of T Ht() = 0; Ht() = 1 Ht(, T1, T2) = 1 + max(Ht(T1), Ht(T2)) NOTE: Height definition differs from the text Base case H() = 0 used in text

More tree definitions: Fully balanced binary trees  is a FBBT. if T1 and T2 are FBBTs, with Ht(T1) = Ht(T2), then (, T1, T2) is a FBBT.

And more trees: Almost balanced trees  is a ABT. if T1 and T2 are ABTs with Ht(T1) -1  Ht(T2)  Ht(T1)+1 then (, T1, T2) is a ABT.

Is this Tree Almost Balanced?

Structural Induction Show P holds for all basis elements of S. Show that if P holds for elements used to construct a new element of S, then P holds for the new element.

Prove all elements of S are divisible by 3 Basis: 21  S; 24  S; Recursive: if x, y  S, then x + y  S;

Prove that WFFs have the same number of left parentheses as right parentheses

Well Formed Fomulae Basis Step Recursive Step T, F, and s, where is a propositional variable are in WFF Recursive Step If E and F are in WFF then ( E), (E F), (E F), (E F) and (E F) are in WFF

Fully Balanced Binary Tree If T is a FBBT, then N(T) = 2Ht(T) - 1

Binary Trees If T is a binary tree, then N(T)  2Ht(T) - 1 If T = : If T = (, T1, T2) Ht(T1) = x, Ht(T2) = y N(T1)  2x, N(T2)  2y N(T) = N(T1) + N(T2) + 1  2x – 1 + 2y – 1 + 1  2Ht(T) -1 + 2Ht(T) – 1 – 1  2Ht(T) - 1

Almost Balanced Binary Trees Let  = (1 + sqrt(5))/2 Prove N(T)  Ht(T) – 1 Base case: Recursive Case: T = (, T1, T2) Let Ht(T) = k + 1 Suppose Ht(T1)  Ht(T2) Ht(T1) = k, Ht(T2) = k or k-1

Almost Balanced Binary Trees N(T) = N(T1) + N(T2) + 1  k – 1 + k-1 – 1 + 1  k + k-1 – 1 [2 =  + 1]  k+1 – 1