confidential1 tree diagrams. confidential2 warm up find the lower and upper quartiles of the...

41
Confidential 1 Tree Diagrams

Upload: stewart-foster

Post on 12-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Confidential 1

Tree Diagrams

Confidential 2

Warm Up

Find the lower and upper quartiles of the following data sets

1. 23, 25, 27, 29, 31, 33, 35

2. 49, 51, 53, 55, 57, 59, 61

Find the mean, median and mode for the data sets

3. 3000, 3100, 300, 3000, 3300

4. 3.8, 4.2, 4.0, 4.2, 4.2

Confidential 3

Warm Up

Make a back-to-back stem-and-leaf plot to compare the birth dates of Mrs. Jenson’s students.

Boys- 22, 18, 9, 3, 5, 28, 11

Girls- 9, 3, 8, 27, 15, 6, 31

5.

Confidential 4

1. In the raw data, there can be repetitions of observations. The number of times a particular observation repeats itself is called its frequency.

2. When the number of observation is limited, Tally Marks are used to find the frequencies. Tallies are usually marked in bunches of five for ease in Counting

3. When the number of observations is very large, the data is usually organized into groups called class intervals and the data obtained is called the grouped data.

4. A Stem and Leaf Plot is a type of graph that summarizes the shape of a set of data (the distribution) and provides extra detail regarding individual values.

Lets recap our last lesson

Confidential 5

1. Graphs are pictorial representation for a set of data ranges.

2. Graphs can be of different types - Line graph and Bar graph

3. Data Representation on the Graph is Labels

Mean - The average of a group of numbers is called the mean

Median- It is the number present in the middle when the numbers in a set of data are arranged in ascending or descending order

Mode-The number that appears the most often in a listing of number

Confidential 6

A box and whisker plot is used to display a set of data.

To create this plot we first find out median, first quartile and second quartile.

Plot the given data set on a number line.

Mark the highest and lowest data points with connected black circles and make a box between the quartiles and a line through the median.

Box-and-whisker plots Box-and-whisker plots and Circle Graphsand Circle Graphs

Confidential 7

1) Sampling is the art of learning about a very large group of people by getting information from a small set of people. 2) Population is the entire set of individuals, events, units with specified characteristics.

3) Parameter is a summary description of a particular aspect of the entire population.

4) Sample is the subset of the population from which data is collected and used as a basis for making statements about the entire population.

Confidential 8

Nodes • A node may contain a value or a condition or

represents a separate data structure or a tree of its own.

• Each node in a tree has zero or more child nodes, which are below it in the tree

Let us start

We use Tree diagrams to count the possible outcomes of any problem of probability, as well as analyze games of choice.

Confidential 9

More on Nodes• A node that has a child is called the child's

Parent node (or ancestor node, or superior).

• A node has at most one parent.

• The height of a node is the length of the longest downward path to a leaf from that node.

• The height of the root is the height of the tree.

• The depth of a node is the length of the path to its root.

Confidential 10

Root nodes

The topmost node in a tree is called the root node.

Being the topmost node, the root node will not have parents.

It is the node at which operations on the tree commonly begin.Every node in a tree can be seen as the root

node of the sub-tree rooted at that node.

Confidential 11

Leaf nodes

Nodes at the bottommost level of the tree are called leaf nodes.

Since they are at the bottommost level, they do not have any children.

Confidential 12

Internal nodes

An internal node or inner node is any node of a tree that has child nodes and is thus not a leaf node

Confidential 13

Sub tree

• A Sub tree is a portion of a tree data structure that can be viewed as a complete tree in itself.

• Any node in a tree T, together with all the nodes below it, comprise a Sub tree of T.

Confidential 14

More on Sub Tree

The Sub tree corresponding to the root node is the entire tree.

The Sub tree corresponding to any other node is called a Proper Sub tree

Confidential 15

Tree ordering

There are two basic types of trees.

Unordered Tree

Ordered Tree

Confidential 16

Unordered Tree

In an unordered tree, a tree is a tree in a purely structural sense —

that is to say, given a node, there is no order for the children of that node.

Confidential 17

Ordered Tree

A tree on which an order is imposed — ordered Tree.

for example, by assigning different natural numbers to each edge leading to a node's children — is called an edge-labeled tree or an ordered tree .

Confidential 18

Forest

• A Forest is an ordered set of ordered trees.

• In order, preorder and post order traversals are defined recursively for forest

Confidential 19

Let us Study Traversal of Trees

In orderPreorderPost order

Confidential 20

In order

• Traverse in-order the forest formed by the sub-trees of the first tree in the forest, if any.

• Visit the root of the first tree.

• Traverse in-order the forest formed by the remaining trees in the forest, if any.

Confidential 21

Preorder

• Visit the root of the first tree. • Traverse preorder the forest

formed by the sub trees of the first tree in the forest, if any.

• Traverse preorder the forest formed by the remaining trees in the forest, if any.

Confidential 22

Post order

• Traverse post order the forest formed by the sub trees of the first tree in the forest, if any.

• Traverse post order the forest formed by the remaining trees in the forest, if any.

• Visit the root of the first tree.

Confidential 23

Tree representations

• Common representations represent the nodes as records allocated on the heap with pointers to their children, their parents, or both, or as items in an array, with relationships between them determined by their positions in the array (e.g., binary heap).

Confidential 24

Trees as graphs

• In graph theory, a tree is a connected acyclic graph.

• A rooted tree is such a graph with a vertex singled out as the root.

• In this case, any two vertices connected by an edge inherit a parent-child relationship.

• An acyclic graph with multiple connected components or a set of rooted trees is sometimes called a forest.

Confidential 25

Traversal methods

• Stepping through the items of a tree, by means of the connections between parents and children, is called walking the tree, and the action is a walk of the tree.

• Often, an operation might be performed when a pointer arrives at a particular node.

Confidential 26

Preorder And Post order Walk

• A walk in which each parent node is traversed before its children is called a pre-order walk;

• A walk in which the children are traversed before their respective parents are traversed is called a post-order walk.

Confidential 27

Common operations

• Enumerating all the items • Searching for an item • Adding a new item at a certain position on the tree • Deleting an item • Removing a whole section of a tree (called

pruning) • Adding a whole section to a tree (called grafting) • Finding the root for any node

Confidential 28

A family has three children.  How many outcomes are in the sample space that indicates the sex of the children?  Assume that the probability of male (M) and the probability of female (F) are each 1/2.

Sample space:     { MMF      MFM      MFF      FMM      FMFFFM FFF MMM }

 There are 8 outcomes in the sample space.The probability of each outcome is

1/2 • 1/2 • 1/2 = 1/8.

Example

Confidential 29

Tree diagram

Confidential 30

1.Draw tree structure for Alphabets from A to I

Assessment

Confidential 31

2. Implement sub tree for tree.

3. Mention the tree is ordered or not.

Confidential 32

4. Mention preorder traversal.

5. Mention post order traversal.

6. Mention in order traversal.

Confidential 33

7.Find leaf nodes

8.Find the preorder walk of the tree

Confidential 34

9. Find post order walk of the tree.

10 Mention level order sequencing

Confidential 35

1. Make a tree diagram and list the outcomes.

12

3A

BC

Spinning the spinner and choosing a card

Confidential 36

2. Show the sample space for tossing one penny and rolling one die.  (H = heads, T = tails)

Confidential 37

3. Draw A tree Structure in implementing the hierarchy of developing triangle

hint : figure…polygon…triangle …… types of triangle

Confidential 38

Lets recap what we have learned in this

lesson There are two basic types of trees. • Unordered Tree• Ordered Tree

In an unordered tree, a tree is a tree in a purely structural sense

A tree on which an order is imposed — ordered Tree

A node may contain a value or a condition or represents a separate data structure or a tree of its own.

Each node in a tree has zero or more child nodes, which are below it in the tree

Confidential 39

A Sub tree is a portion of a tree data structure that can be viewed as a complete tree in itself

A Forest is an ordered set of ordered trees

Traversal of Trees

• In order• Preorder• Post order

In graph theory, a tree is a connected acyclic graph.

Confidential 40

Preorder And Post order Walk

• A walk in which each parent node is traversed before its children is called a pre-order walk;

• A walk in which the children are traversed before their respective parents are traversed is called a post-order walk.

Confidential 41