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
Get step-by-step solutions from verified subject matter experts
