#include <iostream>
using namespace std;
struct ListNode{
int value;
ListNode* next;
};
void add_to_tail(ListNode** pHead,int value){
ListNode* pNew = new ListNode();
pNew->value = value;
pNew->next = NULL;
if(pHead == NULL){
*pHead = pNew;
}else{
ListNode* pNode = *pHead;
while(pNode->next != NULL){
pNode = pNode->next;
}
pNode->next = pNew;
}
}
void remove_node(ListNode** pHead,int value){
if(pHead == NULL || *pHead == NULL){
return;
}
ListNode* pToBeDeleted = NULL;
if((*pHead)->value == value){
pToBeDeleted = *pHead;
*pHead = (*pHead)->next;
}else{
ListNode* pNode = *pHead;
while(pNode->next != NULL && pNode->next->value != value){
pNode = pNode->next;
}
if(pNode->next != NULL && pNode->next->value == value){
pToBeDeleted = pNode->next;
pNode->next = pNode->next->next;
}
}
if(pToBeDeleted != NULL){
delete pToBeDeleted;
pToBeDeleted = NULL;
}
}
int main(int argc, char** argv) {
return 0;
}