840 likes | 861 Views
Learn about binary trees, properties, traversal techniques, and how to implement them using arrays. Explore binary tree theorems and external path lengths.
E N D
Chapter 9 Binary Trees
Chap.9 Contents 9.1 Definition of Binary Tree 9.2 Properties of Binary Trees 9.3 The Binary Tree Theorem 9.4 External Path Length 9.5 Traversals of a Binary Tree
9.1 Definition of Binary Tree binary tree t 可為 empty tree 或 包含: 一個rootelement, 與兩個不同的binary trees, 分別叫 t 的left sub-tree及 right sub-tree
Binary trees (elements 大小無規定) 1 2 2 3 1 3
Tri-nary (3-nary) search tree 2 4 1 3 5 What about N-nary search tree(n-元搜尋樹)? It is called B tree.
This is NOT a binary search tree 5 3 7 4 1 9 8 Because 4 is NOT less than 3
level (x), the level of x, is the same as the depth (x). Is height (t) the same as depth(x)? ANS: No. See next page, height(50) is 3. depth(62) is 2.
這暗示我們: Complete binary tree 可用array來實作. L A B C D E R S F G