in Programming edited by
1,966 views
1 vote
1 vote

in Programming edited by
2.0k views

2 Comments

Question taken from official website. Link : http://cds.iisc.ac.in/wp-content/uploads/model_question.pdf 

0
0
I am trying...

while(current->next!=NULL && current->value<deleteValue)
{
previous=current;  
current=current->next;
}

if(current->value==deleteValue)
{
if(previous==NULL)  //If the deleteValue is the first node
head=current->next;  //Change the head

else
{
previous->next=current->next; 
}

if(current->next!=NULL) //If the node to be deleted is not the last node
current->next->prev=previous;
}

 

However I couldn't find enough blank to free the node.

 

0
0

Please log in or register to answer this question.

Related questions