Chapter 8 Binary and other trees
Chapter 8 Binary and other trees
Two kinds of data structure Linear: list, stack, queue, string Non-linear: tree, graph
Two kinds of data structure • Linear: list, stack, queue, string • Non-linear: tree, graph
8. 1 Tree 1. Definition: A tree t is a finite nonempty set of elements One of these elements is called the root, and the remaining elements(if any are partitioned into trees which are called the subtrees of t
8.1 Tree 1.Definition: A tree T is a finite nonempty set of elements. One of these elements is called the root, and the remaining elements(if any) are partitioned into trees which are called the subtrees of T
8. 1 Tree example B C ①D E)①G①① KL
8.1 Tree • example A B C D E F G H I J K L M
8. 1 Tree Terminology Degree of an elememts: the number of children it has Degree of a tree: the maximum of its element d legree Leaf: element whose degree is o Branch: element whose degree is not o
8.1 Tree 2.Terminology • Degree of an elememts: the number of children it has. • Degree of a tree: the maximum of its element degrees • Leaf: element whose degree is 0 • Branch: element whose degree is not 0