So I'm studying and practicing for a placement exam and was given a few example programs. One of the programs had two parts, one is to create a linked list. The second part was to was to add a recursion function to the existing program. Here is my class...
class IntegerList
{
private:
int length;
IntListNode * head;
public:
IntegerList();
~IntegerList();
void makeEmpty();
bool isFull() const;
int getLength() const;
void insertItem(int item);
void deleteItem(int item);
void addAtPosition(int number, int position);
void sum(); //this is the part im trying to add
void printList();
};
I am having trouble writing a recursion function that will add the integers already in the list. I would show what I have so far for my function implementation but I don't even know where to start. Some pseudo code would be cool, but any help is appreciated, thanks.