Concepts

Concepts:

Root, Node, Link, Children Parent, Sibling, Leaf, Grandparent, Grandchildren, ancestor, descendent, subtree,

Recursive data structure

N node => N-1 edges

Depth: length of path from root to x/ No. of edges in path from root to x

Height: No. of edges in logest path from x to a leaf.

Height of tree: Height of root node.

Binary Tree: a tree in which only has two children

Class Node { int data; Node left; Node right; }

Applications:

  • Storing naturally
  • Organize data
  • trie
  • network routing algorithm