Question: Given the following singly-linked node class and variable declarations, answer questions 5.1-5.2 12 struct node 13 14 node *next; 15 16 i 17 18 class
Given the following singly-linked node class and variable declarations, answer questions 5.1-5.2 12 struct node 13 14 node *next; 15 16 i 17 18 class Listf 19 private: 20 int size; 21 22 node *tail; 23 public: 24 25 26 List(const int &value)( int data node *head; size-e;} List ( ){head = NULL; tail //another constructor NULL; = node *temp = new node(); temp->datavalue; head-temp: tail-temp; size++i 28 30 31 5.1 Examine the code of the following unnamed member function (void xxx (0) of Class List, what is the best name you would give to this function? The name should best reflect what the function performs. Briefly justify your answer. [2 points] 81 void xxxx ( 83 84 85 node *temp new node; temp shead; while (temp !=NULL){ cout data next 87 89 90 5.2 Complete the following C++ code for void insert_start(int value), replace ??? with the correct expression(s). This function inserts an element (value) at the start of the list.[4 points] 30 void insert start(int value) 31 32 node *temp new node); temp->data??? temp->next = ?? if (head-NULL) 34 tail-???: 35 36 37 38 39 40 head = ???; size++i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
