bool List:: ListInsertHead(Node *pNode ) { Node *temp = m_pList->next; //m_pList是在链表里的一个Node指针 m_pList->next = NULL; ListInsertTail(pNode); ListInsertTail(temp); m_iLenth++; return true; } bool List::ListInsertTail(Node *pNode) { Node *currentNode = m_pList; while (currentNode ->next!=NULL ) { currentNode = currentNode->next; } ListSetNull(pNode); currentNode->next = pNode; m_iLenth++; return true; } bool List::ListSetNull(Node *pNode) { Node *currentNode = pNode; while (currentNode->next != NULL) { currentNode = currentNode->next; } currentNode->next = NULL; return true; }
相关分类