Lecture 36 Section 12.2 Mon, Apr 23, 2007 Binary Trees Lecture 36 Section 12.2 Mon, Apr 23, 2007 2/17/2019 Binary Trees
Binary Trees A binary tree is a data structure with the following properties. It is either empty or it has a root node. Each node in the binary tree may have up to two children (called left and right). Each node, except the root node, has exactly one parent. The root node has no parent. 2/17/2019 Binary Trees
A Binary Tree 10 20 30 40 50 60 70 2/17/2019 Binary Trees
Terminology The tree metaphor The family metaphor tree, root, branch, leaf. The family metaphor parent, child, sibling, ancestor, descendant. 2/17/2019 Binary Trees
Tree Terminology 10 20 30 40 50 60 70 2/17/2019 Binary Trees
Tree Terminology Root 10 20 30 40 50 60 70 2/17/2019 Binary Trees
Tree Terminology 10 20 30 40 50 60 70 Parent 2/17/2019 Binary Trees
Tree Terminology 10 20 30 40 50 60 70 Leaves 2/17/2019 Binary Trees
Tree Terminology 10 20 30 40 50 60 70 Right Child 2/17/2019 Binary Trees
Tree Terminology Subtree 10 20 30 40 50 60 70 2/17/2019 Binary Trees