Problem 1:
I was wondering if it's possible to add for example the struct below into a binary tree:
struct Appoint
{
string place;
string title;
int hour, minute;
int durationHr, durationMin;
};
I want the above struct to be sorted in the binary tree by hour and minute.
From what i've been looking on the internet though it seems that only one kind of variable can be entered in a binary tree? Is it not possible to add after the int hour and minute into the node of a binary tree with the rest of the Appoint struct?
I have been trying to code the structs for the beginning of the program and it looks like this and I would like to know if i am going the right way about it.
struct Appoint
{
string place;
string title;
int hour, minute;
int durationHr, durationMin;
};
struct TreeNode {
Appoint app; //The data in this node. Is this possible to put in here and use?
TreeNode *left; //left subtree
TreeNode * right; //right subtree
TreeNode(Appoint temp) {
//Constructor defined. Do i need to do this to made a node containing the struct?
temp = app;
left = NULL;
right = NULL;
}
};
Problem 2:
If the above is at all possible could anyone show me a basic example of how i could insert all the struct into a node please?