I'm trying to figure out how to use the date as a key in an AVL tree. In particular, I have the following:
1 2 3 4 5 6 7 8 9 10 11
struct date_field {
int day;
int month;
int year;
};
struct foo {
std::string fieldA;
std::string fieldB;
date_field date;
};
I want to insert foos into my AVL tree and keep things sorted using the date field. Two different foos can have identical date fields, but let's just assume that the combination of fieldA and fieldB will be unique. The order of two or more such foos in the AVL tree doesn't matter.
I was thinking of somehow changing date_field to a long and use that as the key and also somehow integrating a hash of fieldA and fieldB in there. I'm just stuck on how to maintain the order using the date if I do it that way.