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

Implement this function: void list_piece(const node* start_ptr, const node* end_

ID: 3859446 • Letter: I

Question

Implement this function: void list_piece(const node* start_ptr, const node* end_ptr, node*& head_ptr, node*& tail_ptr) //Precondition: start_ptr and end_ptr are pointers to nodes on the same //linked list, with the start_ptr node at or before the end_ptr node. //Postcondition: head_ptr and tail_ptr are the head and tail pointers //for a new list that contains the items from start_ptr up to but not //including end_ptr. The end.ptr may also be NULL, in which case the //new list contains elements from start_ptr to the end of the list.

Explanation / Answer

Answer:

void node :: display(node *begin)
{
node *read1 = begin;   
int non = 0;

while(read1!=NULL)
{
cout<<"the value of Val at"<<non<<"th node is: "<<read1->val<<endl;
read1 = read1->next;
non++;
}


}