Tree Data Structure - I

Trees



  1. The data is organised in a hierarchial manner.
  2. Terminology:
    1. Node
    2. Edges
    3. Parent Node
    4. Child Node
    5. Leaf Node
    6. Level
    7. Height
    8. Siblings
    9. Path
      There exists only one path between any two nodes
    10. Ancestor: Any node z is ancestor of x if z lies in the path between root node and x
    11. Descedant: Nodes which are not ancestors to x are the descendant to x.
    12. Subtree: The root of subtree is usually used to name that subtree
    13. Degree
    14. Forest
  3. Definition of a tree
  4. Binary Tree
    An empty tree can be a binary tree
  5. Similar trees: If same struture
  6. Copies: Same struccture and same contents
  7. Properties:
    1. Max no of nodes on any level x is 2x
    2. Max no of nodes in a tree with a heoght h is 2h-1
    3. The minimum number of nodes possible in a binary tree of height h is h.
    4. If a binary tree contains n nodes, then its maximum heoght possible is log2(n+1)
    5. Total number of nodes= total no of edges+1
  8. Strictly Binary Tree:
    Degree is either 0 or 2
    Properties:
    1. A strictly binary tree with n non leaf nodes has (n+1) leaf nodes.
    2. A strictly binary tree with n leaf nodes has 2n-2 nodes( n leaf nodes + n-1 non leaf nodes)
  9. Extended Binary Tree: In a binary tree, each empty subtree is replaced by a special node i.e.., adding special nodes to leaf nodes and nodes with a single child.
  10. The trees which a minimum number of nodes are called skew trees.

Comments

Popular

Traversal In A Binary Tree - Tree -3

Tree data structure - 2

Pre Order Traversal In Binary Tree