added code for deleting node from list given its pointer