Start with the file linkedList.c from the notes for chapter 12as modified below. Use the same style of linked list as discussedthere. struct NODE { struct NODE *link; int value; }; typedefstruct NODE Node; Add the following three functions. Put yourfunctions in a separate file, called myLLfunctions.c and useseparate compilation with the two files. You will need the structdefinitions at the top of your file. C:Csource>gcclinkedListTester.c myLLfunctions.c C:Csource>a 1.
Write the function int countTarget(Node *start, int target) thatcounts the number of times the target value occurs in the linkedlist. The parameter start points to the first node of the linkedlist. If the target does not occur in the list, return 0. If thelinked list is empty, return 0.
2. Write the function int findMin( Node *start ) That finds theminimum value in the linked list and returns it. If the linked listis empty the function evaluates to 0; otherwise it evaluates to theminimum.
3. Write the function int deleteFirst(Node **ptrToHeadPtr) thatdeletes the first node of a singly linked list. The return value is1 if a Node was deleted, or 0 if the list was empty and no Node wasdeleted. The head pointer variable to the linked list in main() maybe altered, so the parameter is a pointer to the head pointervariable.
#define MAXELT 10 /* Keep structs and functions as before.Change main to the following */
int main()
{
Node *HeadPtr = NULL;
int j, target, llLength;
srand( time(NULL) );
printf(“size of list: “);
scanf( ” %d”, &llLength );
for ( j=0; j<llength; j++)
{
insertFirst( &HeadPtr, rand()%MAXELT );
}
traverse( HeadPtr );
printf(“nenter target: “);
scanf(” %d”, &target );
printf(“number found: %dn”, countTarget( HeadPtr, target ));
printf(“nminimum: %dn”, findMin( HeadPtr ) );
while ( deleteFirst( &HeadPtr ) ) { printf(“nnewlist:n”);
traverse( HeadPtr );
}
freeList( HeadPtr );
return 1;
}
LANGUAGE IS IN C
Expert Answer
Answer to Start with the file linkedList.c from the notes for chapter 12 as modified below. Use the same style of linked list as d…