Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Write C++ statements to do the following: a. Set the info of the second node

ID: 3659078 • Letter: 4

Question

4. Write C++ statements to do the following: a. Set the info of the second node to 52. b. Make current point to the node with info 10. c. Make trail point to the node before temp. d. Make temp point to an empty list e. Set the value of the node before trail to 36. f. Write a while loop to make current point to the node with info 10. 5. Mark each of the following statements as valid or invalid. If a statement is invalid, explain why. a. current = list; b. temp ->link->link = NULL; c. trail -> link = 0; d. *temp = last; e. list = 75; f. temp ->link -> info =75; g. current -> info = info = trail ->link; h. *list = *last; i. current = last; j. cout <<trail -> link -> link -> info; 6. Write C++ statements to do the following: a. Write a C++ code so that current traverses the entire list. b. Create the node with info 68 and insert between trail and last. c. Delete the last node of the list and also deallocate the memory occupied by this node. After deleting the node, make last point to the last node of the list and the link of the last node must be NULL. d. Delete the node with info 10. Also, deallocate the memory occupied by this node. 7. What is the output of the following C++ code? a. while (current !=NULL) cout<<current -> info <<

Explanation / Answer

#include using namespace std; typedef struct node_targ{ char data; struct node_targ *next; }Node; Node *change(Node *root) { Node *temp; temp = root->next->next; root->next->next= root; root = root->next; root->next->next = temp->next; temp->next = root->next->next->next; root->next->next->next=temp; return root; } main() { Node n5 = {'e',NULL}; Node n4 = {'d',&n5}; Node n3 = {'c',&n4}; Node n2 = {'b',&n3}; Node n1 = {'a',&n2}; Node *root; root = &n1; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote