Binary Tree (Array implementation) Talking about representation, trees can be represented in two way: 1) Dynamic Node Representation (Linked Representation). First field for storing left child address, second for storing actual data and third for storing right child address.
In a double linked list, every node consists of three fields. A typical binary tree can be represented as follows: In the binary tree, each node can have at most two children. A complete binary tree can be represented in an array in the following approach. Java program to implement Binary Tree using the Linked List. Given Linked List Representation of Complete Binary Tree, construct the Binary tree. Linked List Representation of Binary Tree We use a double linked list to represent a binary tree. If root node is stored at index i, its left, and right children are stored at indices 2*i+1, 2*i+2 respectively. 2) Array Representation (Sequential Representation). We will use linked representation to make a binary tree in C and then we will implement inorder, preorder and postorder traversals and then finish this post by making a function to calculate the height of the tree. Each node can have zero, one or two children. In this program, we need to create the binary tree by inserting nodes and displaying nodes in in-order fashion.
You can visit Binary Trees for the concepts behind binary trees.