{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec18 - Binaryto edit Master subtitle style Click Trees...

This preview shows pages 1–7. Sign up to view the full content.

Click to edit Master subtitle style 2/7/11 CS/IS C363 DS&A Sundar B. Binary Trees - Traversal(s) and Applications 11

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2/7/11 CS/IS C363 DS&A Sundar B. Binary Tree – Review Definition: A Binary Tree is either an empty Binary Tree OR has a root value and two (sub) Binary Trees. Type Definition BinaryTree = EmptyBinaryTree U (Element * BinaryTree * BinaryTree) Representation (in C) typedef struct _binTree *BinTree; 22
2/7/11 CS/IS C363 DS&A Sundar B. Binary Tree – Review [2] BinaryTree - Operations BinTree createBinTree() boolean isEmptyBinTree(BinTree) Properties: 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2/7/11 CS/IS C363 DS&A Sundar B. Binary Tree – Review [2] BinaryTree - Operations BinTree left(BinTree) BinTree right(BinTree) Element rootVal(BinTree) BinTree makeBinTree(Element, BinTree, BinaryTree) 44
2/7/11 CS/IS C363 DS&A Sundar B. Binary Tree - Traversals Typical Requirements for a traversal: Enumerating the elements in a collection (represented as a binary tree) Applying some function / procedure on each element in a collection (represented as a binary tree) Order of traversal In-Order Traversal: Traverse left, visit Root, Traverse right 55

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2/7/11 CS/IS C363 DS&A Sundar B. Binary Tree - Traversals Consider an expression of the form: (* (* 3 4) (+5 7)) Referred to as a “prefix” expression.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 17

lec18 - Binaryto edit Master subtitle style Click Trees...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online