Define tree
connected undirected graph with no cycles
Define root of a tree
start node for traversals
Define branch of a tree
path from root to an end point
Define height of a tree
number of edges connected to root node and furthest leaf node
Define parent and child mode
- Child node: no children
Define binary tree
-rooted tree where every node has at most two child nodes
Define binary search tree
ordered to optimise searching
Uses for trees
Records for each nodes will contain:
Which side do you do pre-order tree traversal in?
left side
Algorithm of pre-order?
Which side do you do in-order traversal?
below
Algorithm of in-order?
Which side do you do post-order traversal?
right side
Algorithm of post-order?
Uses of binary search trees
- reverse in order, access the values in descending order
Uses of expression trees