solutions27 - if (n == NULL) { deletedNode = L.front;...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 27 -- Solutions //PURPOSE: delete a node from the list //PRECONDITIONS: L is valid list and n is node // in the list or NULL //POSTCONDITIONS: list has node deleted { Node * deletedNode; // delete first node in list
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (n == NULL) { deletedNode = L.front; L.front = deletedNode->next; // check if any nodes left if (L.front == NULL) { L.back = NULL; } } // delete from middle or end of list else { deletedNode = n->next; n->next = deletedNode->next; delete deletedNode; } }...
View Full Document

This homework help was uploaded on 04/16/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Ask a homework question - tutors are online