{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Trees - CSC2100A Tutorial Trees Spring 2006/2007 1 CSC2100A...

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

View Full Document Right Arrow Icon
CSC2100A Spring 2006-2007 1 CSC2100A Tutorial Trees Spring 2006/2007
Background image of page 1

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

View Full Document Right Arrow Icon
CSC2100A Spring 2006-2007 2 Trees - overview Binary tree – Degree of tree is 2 struct BinaryNode { Object element; BinaryNode *left; BinaryNode *rightChild; }; // pseudocode
Background image of page 2
CSC2100A Spring 2006-2007 3 Trees - traversal • Preorder template <class Comparable> void BinarySearchTree<Comparable>::preorder( BinaryNode<Comparable> *t ) const { if( t != NULL ) { cout << t->element << endl; preorder( t->left ); preorder( t->right ); } }
Background image of page 3

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

View Full Document Right Arrow Icon