-
bool NextElem(Node *pCurrenNode, Node *pNextNode);函數的實現 與取前驅所不同的是,只需定位到當前的節點就行了; 兩種情況取不到后繼:定位不到當前的節點、當前的節點為最后的一個節點,即currentNode->next = NULL查看全部
-
bool PriorElem(Node *pCurrenNode, Node *pPreNode)的函數實現 1、取頭結點,申請一個新節點Node *tempNode = NULL; 2、while循環找出pCurrentNode,tempNode存儲上一個節點,currenNode存儲當前的節點 3、在循環中嵌套if判斷語句,對pCurrentNode進行匹配判斷; 4、有兩種情況為沒有前驅:當前的節點為頭結點、當前節點在鏈表中無法找到查看全部
-
int LocateElem(Node *pNode);函數的實現 取頭結點,計數器count=0,循環遍歷鏈表; 在循環中嵌入一個判斷,當數據相等時,返回count的值;查看全部
-
bool GetElem(int i,Node *pNode);函數的實現 先對i的值進行判斷; 在對用for循環對i的位置進行查找 Node *currentNodeBefore = NULL; Node *currentNode = m_pList; currentNodeBefore = currentNode; currentNode = currentNode->next; 最后對i的位置的值進行數值的插入查看全部
-
ListDelete()函數的實現: 先對插入的位置進行判斷; 然后通過循環對i的位置進行查找; 最后對節點進行刪除,并把數據賦值給pNode; return true查看全部
-
ListInsert()函數的實現: 先對插入的位置i進行判斷; 申請一個新的節點,并進行判斷; 進行插入。查看全部
-
使用while,循環遍歷鏈表,到達最后一個結點時,申請一個新節點,賦值然后插入查看全部
-
ListInsert()函數實現查看全部
-
Node的頭文件 int data; Node *next; void printNode();查看全部
-
List的ClearList()函數, Node *currentNode = m_pList->next; while(currentNode != NULL) { Node *temp = currentNode->next; delete currentNode; currentNode = temp; } m_pList->next = NULL; List的析構函數,Clear后還要刪除頭結點。查看全部
-
List的構造函數,對m_pList、m_pList->data、m_plist->next、m_iLength; List的ListEmpty()函數,對m_iLength查看全部
-
Node *m_pList; int m_iLength;查看全部
-
與順序鏈表的區別,不需要size變量。查看全部
-
List的頭文件。查看全部
-
前驅,后繼查看全部
舉報
0/150
提交
取消