Question: struct node { int data; struct node * next; }; typedef struct node * link; void swap_first_third(link A). This function should swap the first and
struct node { int data; struct node * next; };
typedef struct node * link;
void swap_first_third(link A). This function should swap the first and the third nodes in list A by adjusting the links, not copying the items. For this function you need to: 1. Write the code in list_hw.c 2. Give both the data and the result for the testing it in the table from the 2320_H3.pdf document. 3. Make a drawing like the one did in class to show how the links are adjusted. In order to make it easy to correct the drawing, INCLUDE A COPY OF void swapFirstThird(list A) NEXT TO THE DRAWING. Special cases: 1. If the list has only one item, no swap is needed. 2. If the list has 2 items, they should be swapped: if A is 3 -> 7 , it becomes 7 ->
void delete_occurrences(link A, int V). This function should delete (and free) all links in list A that contain value V. For example if A: 15 -> 100 -> 7 -> 5 -> 100 -> 7 -> 30 and we delete value 7, list A will become: A: 15 -> 100 -> 5 -> 100 -> 30
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
