- What are binary trees?
A data structure made of nodes with each node containing atmost 2 children.
Root node = A
Leaf nodes i.e nodes with no children = C,D,E
- Node structure:
We need to store the data,left and right subtrees.So we will have 3 fields.One for data,one for left pointer and one for right pointer.
typedef struct node
{
int data;
struct node* left;
struct node* right;
}node;
No comments:
Post a Comment