Question: 1. (30 points) Given the following link that has 3 nodes (Figure 1), where each two components: an integer variable data field and a pointer

 1. (30 points) Given the following link that has 3 nodes

1. (30 points) Given the following link that has 3 nodes (Figure 1), where each two components: an integer variable "data field" and a pointer link-field', pointing to the next node in the list. We also have a pointer head_ptr" pointing to the head of the list and a pointer "previous_ptr" pointing to the second node head_ptr 2 3 NULL previous_ptr Figure 1 a. (8 points) Write a function void list_head insert(node*& head_ptr, const int &entry); where a new code containing the given entry is added at the head of the list. You can write either C++ code or pseudo code b. (8 points) Write a function void list_insert(node* previous_ptr, const int &entry) where a new code containing the given entry is added after the node that previous_ptr points to. You can write either C++ code or pseudo code c. (4 points) After a and b, what output is produced by the following? (data() and next() are two constant member functions in class node data() returns the value of data_field and next() returns the value of link field) couthead-ptr->data( )endl; coutnext()->data)data( )endl

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!