Hey all,
I'm doing a project to create an address book which uses a binary search tree (AVL node) structure to store, search and sort the data. There are 14 main fields for each address contact. All fields can be represented as strings. The 14th field can have unlimited entries. Note - users can add, edit, delete and sort by individual fields. Also Note - the AVL binary search tree header/template files (template classes) are already provided. So far I can only get them to work for the standard data types and not the class i'm creating.
2 Questions:
Q1) What do yout think is the best/simplest way to architect the base data structure? (initial idea options below)
Q2) When I put in my user defined type (class) as the KeyType of the AVL node, i get a host of compiler errors. I'm guessing this is because i need to overload the << and probably other operators. (example compiler error below) Any other advice?
Here are some options i've come up with and have started testing.
Option 1) create a class with 13 string fields and one vector to hold the multiple entries of the 14th "field". Use this class as the KeyType of the AVL node.
Option 2) create a class with a vector to hold all the fields and the program knows which field it is based on vector index. Use this class as the KeyType of the AVL node.
Option 3) rather than creating a new class, add all 14 member variables to the node itself
// Compiler Error
avltree.cpp: In member function `void AVLClass::SingleRotateLeft(AVLNodeClass*&)':
avltree.cpp:155: error: no match for 'operator<<' in 'std::operator<< [with _Traits = std::char_traits<char>](((std::basic_ostream<char, std::char_traits<char> >&)(&std::cout)), ((const char*)"DEBUG: single rotate left at ")) << ((BSTNodeClass*)ParentPtr)->BSTNodeClass::Info'