Home / Expert Answers / Computer Science / assume-a-standard-linked-list-contains-names-in-alphabetical-order-a-write-down-the-c-struct-pa937

(Solved): Assume a standard linked list contains names in alphabetical order. (a) Write down the C++ struct ...



Assume a standard linked list contains names in alphabetical order.
(a) Write down the C++ struct defining the node for this

Assume a standard linked list contains names in alphabetical order. (a) Write down the C++ struct defining the node for this linked list. [2 marks] (b) Write a function to delete a name from the linked list. The name to be deleted must be passed as a parameter to the function. [6 marks] The following function is used to place a new item at the front of a linked list. There are three (3) errors in this function. Write down what the errors are and also explain how to correct each error. Note that this function is not a method and therefore is not part of a class. void AddNode (Node *listpointer, int newthing) { Node *temp; temp->data newthing; temp->next listpointer; IG markel } = =


We have an Answer from Expert

View Expert Answer

Expert Answer


1. (a) struct Node{ string name; Node* next; }; (b) void deleteName(Node **listpointer,string nm) { Node* temp= *listpointer; Node* prev = NULL; if (temp != NULL && temp
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe