wonder
wonder

Reputation: 193

Difference between the two representation of binary tree

What is the basic difference between the 2 representation of binary tree??

 struct node 
 {
 int data;
 struct node *left;
 struct node *right;
 };



 struct Node {

 char data;

 Node *left;

 Node *right;

 };

To be specific whats the difference is being created by the use of struct in the left and right pointer??

Upvotes: 0

Views: 47

Answers (1)

Pzc
Pzc

Reputation: 88

There's no difference between the two in C++. If I recall correctly the former (struct node *left) was needed in C but not in C++.

Another difference is that the nodes store different data, first one stores an int and the second stores a char.

Upvotes: 1

Related Questions