Tree

12/1/00


Click here to start


Table of Contents

PPT Slide

Tree

Which graphs are trees?

Specify a vertex as root

Specify a root.

Specify a root.

Specify a root.

What if a different root is chosen?

What if a different root is chosen?

What if a different root is chosen?

What if a different root is chosen?

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

Internal Vertex

PPT Slide

Binary Tree

Ordered Binary Tree

Tree Properties

An Ordered Binary Tree

Parent

What is the parent of Ed?

Leaf

How many leaves?

Ancestors

How many ancestors of Ken?

Descendants

How many descendants of Hal?

Level

What is the level of Ted?

Height

What is the height?

Balanced

Is this binary tree balanced?

Searching takes time . . .

A Binary Search Tree (BST) is . . .

Shape of a binary search tree . . .

Inserting ‘E’ into the BST

Inserting ‘F’ into the BST

Inserting ‘T’ into the BST

Inserting ‘A’ into the BST

What binary search tree . . .

Binary search tree . . .

Another binary search tree

Is ‘F’ in the binary search tree?

Traversal Algorithms

PREORDER Traversal Algorithm

Preorder Traversal: J E A H T M Y

INORDER Traversal Algorithm

Inorder Traversal: A E H J M T Y

POSTORDER Traversal Algorithm

PPT Slide

A Binary Expression Tree

A Binary Expression Tree is . . .

A Binary Expression Tree

A Binary Expression Tree

A Binary Expression Tree

Levels Indicate Precedence

Evaluate this binary expression tree

A binary expression tree

A binary expression tree

Inorder Traversal: (A + H) / (M - Y)

Preorder Traversal: / + A H - M Y

PPT Slide

ACKNOWLEDGMENT:

Author: Sylvia Sorkin

Email: ssorkin@ccbc.cc.md.us

Home Page: http://student.ccbc.cc.md.us/~ssorkin/index.html

Download presentation source