Sequential representation of binary trees

Sequential representation of trees is done using single or one-dimensional arrays. Though it is the simplest technique for memory representation, it is inefficient as it requires a lot of memory space. A sequential binary tree follows the following rules:

  • A one-dimensional array, called TREE, is used to store the elements of tree
  • The root of the tree will be stored in the first location. That is, TREE[1] will store the data of the root element.
  • The children of a node stored in location K will be stored in locations (2 × K) and (2 × K+1)
  • The maximum size of the array TREE is given as (2h –1), where h is the height of the tree
  • An empty tree or sub-tree is specified using NULL. If TREE[1] = NULL, then the tree is empty
Binary tree and its sequential 
representation
Binary tree and its sequential
representation

Leave a Comment