Download presentation
Presentation is loading. Please wait.
Published byEstella Hart Modified over 8 years ago
1
03/12/13 Trees and CFGs Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1
2
Last class: recursive functions 2
3
Today’s lecture: Trees and CFGs Trees – Examples of uses – Terminology – Induction on trees Context free grammars (CFGs) – What they are, how they work – Induction on CFG 3
4
Tree: special form of graph with “root” and no cycles 4 root
5
Tree terminology Nodes: root, internal, leaf, level, tree height Relations: parent/child/sibling, ancestor/descendant 5 overhead
6
Another example 6 6 4 7 5 2 3 1 root
7
Another example 7 6 4 7 5 2 3 1 root 6 4 7 5 2 3 1
8
Trees for sorting 8 > < > <
9
Decision trees 9
10
Hierarchical data structure 10
11
Trees for clustering 11 b>5 x x x x x x x x x x x 1 23 a b 5 6 a>6 1 yes no yes 2 3
12
More terminology 12 overhead
13
Induction proof on trees 13 overhead
14
Context-free Grammars 14 overhead
15
CFG Example 15 overhead
16
Examples of parse trees 16 Language Fig: Johnson 2007
17
Examples of parse trees 17 Figs: Zhu and Mumford 2007 Scene parse Object Parse
18
Examples of parse trees 18 Stochastic CFG for blackjack actions
19
Induction proof on CFG 19 overhead
20
CFG example 20 * I like to eat apples and bananas overhead
21
Things to remember Trees are a special graph with root and no cycles, with many uses – Sorting, clustering, finding similar values – Decision tree: machine learning, modeling choices – Parse trees: representing hierarchical structures Context free grammars: generate parse trees Proofs on trees: split at root, use inductive hypothesis on subtrees headed by the root’s children 21
22
Next class: more trees Recursion trees and more proofs with trees 22
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.