Question: FILE Linkedlist.c (below) #include #include #include struct NODE { struct NODE *link; int value; }; typedef struct NODE Node; Node *insertFirst( Node **ptrToHeadPtr, int val

 FILE Linkedlist.c (below) #include #include #include struct NODE { struct NODE

FILE Linkedlist.c (below)

#include #include #include

struct NODE { struct NODE *link; int value; };

typedef struct NODE Node;

Node *insertFirst( Node **ptrToHeadPtr, int val ) { Node *node = (Node *)malloc( sizeof( Node ) ); node->value = val; node->link = *ptrToHeadPtr; *ptrToHeadPtr = node; return node; }

void traverse( Node *p ) { while ( p != NULL ) { printf("%d ", p->value ); p = p->link; } }

void freeList( Node *p ) { Node *temp; while ( p != NULL ) { temp = p; p = p->link; free( temp ); } }

int main() { Node *HeadPtr = NULL;

int j; for ( j=0; j

traverse( HeadPtr ); freeList( HeadPtr ); getchar(); return 1; }

PROGRAM IN LANGUAGEC Additional Linked List Functions Start with the file linkedList.c in the notes for chapter 12. Use the same style of linked list as discussed there. Add the following three functions. A nice way to do this is to put your functions in a separate file, perhaps called myLLfunctions.c and then use the preprocessor to include that file into linkedList.c struct NODE struct NODE link; int value; typedef struct NODE Node; #include "myLLfunctions.c" 1. Write the function int countTarget (Node start, int target) that counts the number of times the target value occurs in the linked list. The parameter start points to the first node of the linked list. If the target does not occur in the list, return 0. If the linked list is empty, return 0. You wil need to write a main) that tests your functions. The functions themselves should not write out anything. Your functions should not use any global variables since the grading program will not have those global variables

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!