This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Unit DT Decision Trees and Recursion In many situations one needs to make a series of decisions. This leads naturally to a structure called a “decision tree.” Decision trees provide a geometrical framework for organizing the decisions. The important aspect is the decisions that are made. Everything we do in this unit could be rewritten to avoid the use of trees; however, trees • give us a powerful intuitive basis for viewing the problems of this chapter, • provide a language for discussing the material, • allow us to view the collection of all decisions in an organized manner. We’ll begin with elementary examples of decision trees. We then show how decision trees can be used to study recursive algorithms. Next we shall look at decision trees and “Bayesian methods” in probability theory. Finally we relate decision trees to induction and recursive equations. Section 1: Basic Concepts of Decision Trees One area of application for decision trees is systematically listing a variety of functions. The simplest general class of functions to list is the entire set n k . We can create a typical element in the list by choosing an element of n and writing it down, choosing another element (possibly the same as before) of n and writing it down next, and so on until we have made k decisions. This generates a function in one line form sequentially: First f (1) is chosen, then f (2) is chosen and so on. We can represent all possible decisions pictorially by writing down the decisions made so far and then some downward “edges” indicating the possible choices for the next decision. We begin this section by discussing the picture of a decision tree, illustrating this with a variety of examples. Then we study how a tree is traversed, which is a way computers deal with the trees. c circlecopyrt Edward A. Bender & S. Gill Williamson 2005. All rights reserved. Decision Trees and Recursion What is a Decision Tree? Example 1 (Decision tree for 2 3 ) Here is an example of a decision tree for the functions 2 3 . We’ve omitted the commas; for example, 121 stands for the function 1,2,1 in oneline form. 1 1 1 1 1 2 2 2 2 2 21 22 211 212 221 222 1 1 1 2 2 2 11 12 111 112 121 122 R The set V = { R , 1 , 2 , 11 , 12 , 21 , 22 , 111 , 112 , 121 , 122 , 211 , 212 , 221 , 222 } is called the set of vertices of the decision tree. The vertex set for a decision tree can be any set, but must be specified in describing the tree. You can see from the picture of the decision tree that the places where the straight line segments (called edges ) of the tree end is where the vertices appear in the picture. Each vertex should appear exactly once in the picture. The symbol R stands for the root of the decision tree. Various choices other than R can be used as the symbol for the root....
View
Full
Document
This note was uploaded on 02/11/2008 for the course CSE 21 taught by Professor Graham during the Fall '07 term at UCSD.
 Fall '07
 Graham
 Recursion

Click to edit the document details