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

/*** *Question 6 *DoubleLinked List */ struct DoubleLinkedNode { int data; Doubl

ID: 3757898 • Letter: #

Question

/***
*Question 6
*DoubleLinked List
*/

struct DoubleLinkedNode
{
int data;
DoubleLinked * prev;
DoubleLinked * next;

};

//write the code for the following function:

bool removeLast(DoubleLinkedNode * & start)
{

//reomove the last node in a double linked list
//return true if the last node was removed
//start holds the address of the first node in the double linked list
// if the double linked list has no members, start holds the value of nullptr


  


}
  // no need to write main.cpp just write the code for this method

Explanation / Answer

bool removeLast(DoubleLinkedNode * & start)
{

if(start==null)
return false;
else
{
DoubleLinkedNode * temp=start;
DoubleLinkedNode * lastNode;


while(temp->next!=null)
temp=-temp->next

lastNode=temp;
temp=temp->prev;
temp->next=NULL;
lastNode->prev=NULL;
delete(lastNode);
return true;
}
}