Question: #include #include struct Node { int data; struct Node* next; }; typedef struct Node NODE; typedef NODE* NODEPTR; static void reverse(NODEPTR* head_ref) { reverse function

 #include #include struct Node { int data; struct Node* next; };

#include #include struct Node { int data; struct Node* next; };

typedef struct Node NODE; typedef NODE* NODEPTR; static void reverse(NODEPTR* head_ref) {

reverse function .................. ................................... . . . . }

void push(NODEPTR* head_ref, int new_data) { NODEPTR new_node = (NODEPTR) malloc(sizeof(NODE)); new_node->data = new_data; new_node->next = (*head_ref); (*head_ref) = new_node; }

void printList(NODEPTR head) { NODEPTR temp = head; while(temp != NULL) { printf("%d ", temp->data); temp = temp->next; } }

int main() { main code .................. ................................... . . . . }

Complete the code in the attached file 1- The code asks the user to enter the number of linked list items 2- The node data is random numbers between the 0-5 3- The code reverses the linked list by changing links between nodes Sample runs of the code: Enter the number of items 10 Given linked list 1 1 0 2 3 1 3 1 2 3 Reversed Linked list 3 2 1 3 1 3 2 0 1 1 Enter the number of items 20 Given linked list 4 4 0 0 4 5 1 2 1 2 1 3 0 4 1 5 1 3 4 1 Reversed Linked list 1 4 3 1 5 1 4 0 3 1 2 1 2 1 5 4 0 0 4 4

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!