Hello,
I made a simple binary tree.
Code:
have a structure NODE
typedef struct node {
char name[MAX];
char surname[MAX];
int counting;
struct node *l, *r;
} NODE;
I have function,that make new nodes and insert nodes in to the tree.........
For example i will put this in my tree.
John Smith
Adam Smith
Mike Johnson
Peter Thomas
Steven Thomas
I do not know how to write function,that will PRINT surnames only once,and will print number of appearance of surnames.
PRINT RESULT will be like this :
Smith 2
Johnson 1
Thomas 2
Does anyone know how to write this function,that will print surnames only once ?
Thanks in advantage!