Your task is to implement the list class data structure, as defined in class. That is, your implementation should include the following public member functions:
class list
{
private:
// whatever private data members you might need.
public:
list();
bool add(datanode);
bool is_empty();
bool is_full();
bool remove(datanode);
datanode * search(datanode);
bool display(); // displays all the elements of the lis
bool reverse();
}
In addition, you can add any other member functions you might find usefull,
as long as they are private.
Notice that almost all of these member functions have already been discussed/implemented in class. The one exception is function reverse(). reverse() is a function that changes the order of the members of the list so that, after the function finishes, they are in exactly the opposite order that they were before executing the function.
For example, if the original list was {a, b, c, d}, after executing
reverse() it looks like {d, c, b, a}. (Hint: you can, if you want,
use a second, temporary list, as long as you de-allocated it once the process
of reversing the list is finished. You do not have to use a secondary list
if you do not want to).
What are you putting into the list? That is, what exactly is
datanode?
I will leave that up to you, as long as whatever you use 1) containt more
than one type of variable (that is, it has to be more complex that an int
or an array) and 2) it gets implemented as a class (that is, it is not
implemented as a struct). 3) It does not contain a pointer to the
next datanode. Other than that, you are free to design it. You CAN, for
example, use a USD from the first assignment, or a flight, or anything
else.
You should divide your project into several files in the same way we have talked in class. In addition, your list implementation should have the same flexibilities we have talked to in class. You are free to use templates, if you want to, but you do not have to.