TREES
One example of data structure linked nodes that not linear
Why ? some operations be more efficient
Defined as :
o set nodes + set directed edges
o single root node
o every non-root node has exactly one incoming link & zero or more outgoing links
o no cycles
Be used for faster search, organising files, formal languages, etc…
TREE VISUALISED
,BINARY TREES
Trees where each parent has at most 2 children
Call them left & right
EXERCISE :
What is the :
o Root 2
o Leaves 1,5
o Size 5
o Height 3
OPERATIONS ON BINARY TREES
Traversals
o InOrder
o PreOrder
o PostOrder
o Level Order
, BinaryTreesNode
BinaryTree - Construction
BinaryTree - height