T1 t2 t1 complete binary tree dept of computer science

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: binary tree, • nothing else is a complete binary tree. T1 T2 T1 complete binary tree Dept. of Computer Science, University of Toronto, St. George Campus T2 T3 complete ternary tree Page 1 of 2 CSC 236 H1S Homework Assignment # 1 Winter 2012 Similarly, we can define complete ternary tree s: • a single node is a complete ternary tree, • if T1 , T2 , and T3 are complete ternary trees with the same height, then the tree constructed by placing T1 , T2 , and T3 under a new root node (as illustrated above on the right) is also a complete ternary tree, • nothing else is a complete ternary tree. A coloured complete ternary tree is a complete ternary tree in which every leaf node has been assigned one of two colours (red or blue). Only the leaves are coloured — internal nodes are colourless. A subtree of a tree T is a subset of T ’s leaves along with all of the leave’s ancestors (and the edges connecting them). Every complete ternary tree contains many complete binary subtrees — simply pick two children to keep and one to remove for every internal node. A monochromatic complete binary subtree of a coloured complete ternary tree is...
View Full Document

Ask a homework question - tutors are online