Question: 25.(25 pts. Please consider the following struct definition struct Node! int data: struct Noda next; }; typedef struct Noda Node: typedef Node *Nodeptr: Nodeptr head;
25.(25 pts. Please consider the following struct definition struct Node! int data: struct Noda next; }; typedef struct Noda Node: typedef Node *Nodeptr: Nodeptr head; // Assume that it is a pointer to a list with many nodes. In this question, you will implement the promote function for a Queue structure, which takes an integer and moves the element at that position in the queue (where the head is at position 0) one position closer to the head. void promote (Nodeptr *ptr, int index) Sample usage below - the queue contents are shown in list form, with the head on the left and the tail on the right: Suppose that the queue contains (3, 5, 9, 2, 4, 8, 71 promote(&head, 1) then, the queue will contain (5, 3, 9, 2, 4, 8, 71 promote(&head, 3) then, the queue will contain (5, 3, 2, 9, 4, 8, 71 . . You should not change the value contained in any of the nodes nor create any new nodes. Instead, your implementation should work by re-linking existing nodes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
