Question: Implement the following functions. a. int count(listNode *listPtr, int value); Count how many times the value appeared in the list. This function should not need

Implement the following functions.

a.

int count(listNode *listPtr, int value);

Count how many times the value appeared in the list. This function should not

need to allocate or free any memory.

b.

void insert(listNode **listPtr, int value);

Add a new node with value to the TAIL of the list. This function should call malloc

exactly once. If the original list was empty, remember to update the head pointer

stored in location pointed to by listPtr.

c.

void reverse(listNode **listPtr);

Reverse the order of all nodes in the list. Do not allocate or free any memory

space for this function. You should be able to reverse the list simply by

relinking/rearranging the existing allocated nodes.

d.

void removeAll(listNode **listPtr, int value);

Remove all nodes that has the given value in the list and free the memory space

for those nodes. Please make sure that after removing the value, the remaining

list is still properly linked together. Also watch out for the corner cases of the

value is at the head or tail of the list.

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!