Download presentation
Presentation is loading. Please wait.
1
Binary Tree Terminology Linear versus hierarchical data Tree – connected graph with no cycles Child Parent Descendant Sibling Ancestor Leaf vs. internal node Level Height Binary / K-ary
2
Binary Tree - More Terminology Full – Theorem: The number of leaf nodes in a non-empty full binary tree is one more than the number of internal nodes – Theorem: The number of pointers in a non-empty binary tree is one more than the number of internal nodes Complete Ordered Skewed Tree
3
Arithmetic expression tree (8 + 1) * 3 /((9 – 5) + 2) + (0 * (7 – 4) + 6) + + +* + / 81 3- 95 * 2 47 -0 6
4
Traversals Pre-order – Visit – TravelLeft – TravelRight In-order – TravelLeft – Visit – TravelRight Post-order – TravelLeft – TravelRight – Visit
5
Pre-order Traversal of expression tree +/*+813+-952+*0-746 + + +* + / 81 3- 95 * 2 47 -0 6
6
In-order Traversal of expression tree 8+1*3/9-5+2+0*7-4+6 + + +* + / 81 3- 95 * 2 47 -0 6
7
Post-order Traversal of expression tree 81+3*95-2+/074-*6++ + + +* + / 81 3- 95 * 2 47 -0 6
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.