Question: C++ void CLL::push(char data) { // You write - if the size is 0, add a first node in the linked list // by calling

C++

void CLL::push(char data) { // You write - if the size is 0, add a first node in the linked list

// by calling addFirst. Otherwise add a new node to the end of the linked list. Note that this

// linked list is circular, so you must make the last node's next pointer point to the first node.

}

void CLL::addFirst(char data) {

// you write - add the very first node to the linked list

}

void CLL::addAtFront(char data) {

// you write - if the size of the linked list is 0, add a first node by calling addFirst.

//Otherwise add a new node to the beginning of the list

//Since this linked list is circular, you must make the last node now point to this new node

//you just added to the front of the linked list

}

void CLL::removeNext(SNode *n) {

// Longest method - given node n, remove the next node in the linked list.

// you have 4 conditions:

//1: there's only one node in the list, in which case you delete that node and set the size to 0

//2: n's next node is a last node, in which case n becomes the new last node and n's next must point

// to the first node in the list (remember to decrease the size of the list)

//3: n's next node is the first node in the list (i.e., n is the last node in the list), in which case

// n's next becomes first's next, first is deleted, and first becomes n's next (again, remember

// to decrease the size)

//4: n is just some node in the middle of the list, in which case you should create a tmp node to point

// to n's next, then set n's next to n's next's next, and then delete the tmp node (again, decrease

// size).

}

void CLL::printList(){

// print out the data in each node in the linked list, starting at the first node.

}

You will also be modifying the file DuckDuckGoose.cpp to fill in the methods as defined below:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!