Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
1
Parts of a Tree
2
Parts of a Tree nodes
3
Parts of a Tree parent node
4
Parts of a Tree child nodes parent node
5
Parts of a Tree child nodes parent node
6
Parts of a Tree root node
7
Parts of a Tree leaf nodes
8
Parts of a Tree sub-tree
9
Parts of a Tree sub-tree
10
Parts of a Tree sub-tree
11
Parts of a Tree sub-tree
12
Binary Tree Setiap Simpul hanya boleh memiliki paling banyak 2 buah cabang
13
Traversal Systematic way of visiting all the nodes.
(setiap kunjungan hanya mengunjungi tepat satu kali) Methods (metode): Levelorder, Preorder, Inorder, and Postorder They all traverse the left subtree before the right subtree. (kunjungan selalu di mulai dari cabang kiri ke mudian ke cabang kanan)
14
Level order
15
Example: level order 43 31 64 20 40 56 89 28 33 47 59
16
Preorder Traversal Visit the node. Traverse the left subtree.
Traverse the right subtree.
18
Example: Preorder 43 43 31 64 31 64 20 20 40 56 89 40 56 89 28 33 47 59 28 33 47 59
19
Inorder Traversal Traverse the left subtree. Visit the node.
Traverse the right subtree.
21
Example: Inorder 43 43 31 64 31 64 20 20 40 56 89 40 56 89 28 33 47 59 28 33 47 59
22
Postorder Traversal Traverse the left subtree.
Traverse the right subtree. Visit the node.
24
Example: Postorder 43 43 31 64 31 64 20 20 40 56 89 40 56 89 28 33 47 59 28 33 47 59
25
Expression Tree A Binary Tree built with operands and operators.
Also known as a parse tree. Used in compilers.
26
Example: Expression Tree
+ / / 1 3 * 4 6 7 1/ *7 / 4
27
Notation Preorder Inorder Postorder Prefix Notation Infix Notation
Postfix Notation
28
Example: Infix + + / / / / 1 1 3 * 4 3 * 4 6 7 6 7
29
Example: Postfix 1 + + / / / / 1 3 * 4 3 * 4 6 7 6 7
Recall: Reverse Polish Notation
30
Example: Prefix + / / 1 3 * 4 6 7 + / 1 3 / * 6 7 4
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.