How to delete a node in a linked list?

后端 未结 3 1464
孤独总比滥情好
孤独总比滥情好 2021-01-23 14:33

This is what I have so far, but it\'s not working in the test file. Basically skips to the else if(cnode == preposition)

void LinkedList::Delete(Nod         


        
3条回答
  •  不知归路
    2021-01-23 15:05

    1: Take the pointer from the previous node and point it to the next one after the one you want to delete

    2: Delete the pointer from the previous node to the current node

    3: Delete the pointer from the next node to the current node (if it is a doubly-linked list)

提交回复
热议问题