Question: c++ programming. please explain to me, thanks Consider the node structure for a linked list struct Node int data; struct Node next ; The following

c++ programming. please explain to me, thanks
Consider the node structure for a linked list struct Node int data; struct Node next ; The following code is for appending a node to a linked list passed as head_ref. The data of the new node is passed as new_data. What is the best worst case complexity of the function? The linked list has n elements in it. void append (struct Noder head_ref, int new_data) Node* new _node = new Node (); new node-data = new data ; Node *last *head _ref; new_node-next = NULL ; if (*head_ref== NULL ) *head_ref = new node ; return; while (last->next != NULL ) last = last->next; last->next = new node ; return; Select one. o a. Best NY 1) and Worst: on ) o D. Best a X log n ) and worst on logn ) 0 C. Best: an ) and worst of nn ) 0 a. Best : nX 1) and worst of n ?) Check
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
