CS 4320 SOFTWARE TESTING AND QUALITY ASSURANCE Consider a DOUBLY-LINKED list with a next and prev pointer: INPUT: next --------> ---------> ---------> b k r m <--------- <--------- <--------- prev ^ | p OUTPUT: SAME LIST BUT p NODE AND NEXT NODE HAVE BEEN SWAPPED: next --------> ---------> ---------> b r k m <--------- <--------- <--------- prev ^ | p typedef struct node *node_ptr; struct node { char element; node_ptr next; node_ptr prev; }; Consider the following functions which attempt to SWAP two adjacent nodes. In the diagram above, the function should swap the ``k'' node and the ``r'' node. You can assume that there are nodes on either side of the nodes which are to be swapped. The function is provided with a pointer to the first of the two nodes to be swapped. For each function below, perform a CODE WALKTHROUGH and circle CORRECT or INCORRECT. If a solution is INCORRECT, then state the result. void swap_with_next1(node_ptr p) { // CORRECT / INCORRECT node_ptr before_p, after_p; 1. before_p = p->prev; 2. after_p = p->next; 3. p->next = after_p->next; 4. before_p->next = after_p; 5. after_p->next = p; 6. p->next->prev = p; 7. p->prev = after_p; 8. after_p->prev = before_p; } void swap_with_next2(node_ptr p) { // CORRECT / INCORRECT 1. p->prev->next = p->next; 2. p->next->prev = p->prev; 3. p->next->next->prev = p; 4. p->next = p->next->next; 5. p->prev = p->prev->next; 6. p->prev->next = p; } void swap_with_next3(node_ptr p) { // CORRECT / INCORRECT 1. p->prev->next = p->next; 2. p->next = p->next->next; 3. p->next->prev = p->prev; 4. p->next->next->prev = p; 5. p->next->next = p; 6. p->prev = p->next; }