Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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" 1Write 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. 2. Write the function int findMin Node *start, int *min ) That finds the minimum value in the linked list and returns it in the parameter min. If the linked list is empty the function evaluates to 0 (returns a 0); otherwise it evaluates to 1 3. Write the function int deleteFirst (Node ptrToHeadPtr) that deletes the first node of a singly linked list. The return value is 1 if the operation succeeded, or 0 if not. The operation fails if free) fails. If the list is already empty, change nothing and return a 0 Note that the head pointer variable to the linked list in main) may be altered, so the parameter is a pointer to the head pointer variable. You will 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 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" 1Write 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. 2. Write the function int findMin Node *start, int *min ) That finds the minimum value in the linked list and returns it in the parameter min. If the linked list is empty the function evaluates to 0 (returns a 0); otherwise it evaluates to 1 3. Write the function int deleteFirst (Node ptrToHeadPtr) that deletes the first node of a singly linked list. The return value is 1 if the operation succeeded, or 0 if not. The operation fails if free) fails. If the list is already empty, change nothing and return a 0 Note that the head pointer variable to the linked list in main) may be altered, so the parameter is a pointer to the head pointer variable. You will 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started