Hide Index
- Understanding the problem
- Understanding iterative preorder traversal
- Implement iterative preorder traversal
- Understanding iterative inorder traversal
- Implement iterative inorder traversal
- Understanding iterative postorder traversal
- Implement iterative postorder traversal
- Understanding level order traversal
- Implement level order traversal
- Challenges in construction from preorder traversal
- Challenges in construction from inorder traversal
- Challenges in construction from postorder traversal
- Understanding construction using preorder and inorder traversal
- Construct tree using preorder and inorder traversal
- Understanding construction using postorder and inorder traversal
- Construct tree using postorder and inorder traversal
Structure of a binary tree
Now that we know how individual nodes of a binary tree look in the array implementation, let us look at how they link up together to form a binary tree. Multiple nodes link up together to create the binary tree structure. When implemented as an array, the node's enumeration in its tree representation (its top to bottom, left to right label starting from 0, we learned in the earlier lesson) is used as an index in the array where the data associated with that node is stored.
Individual nodes arranged sequentially in an array
What looks like a tree on paper looks very different when implemented as an array in the computer memory. The resulting binary tree looks like a regular array of nodes in the memory. Let us look at what a binary tree implemented as an array looks like in the computer memory.
Binary tree array implementation in computer memory
Liking the course? Check our discounted plans to continue learning.