Singly Linked List - Deletion
In this lesson, we'll discuss the deletion operation on a singly linked list.
We'll cover the following...
Structure
Each node contains a value and a pointer to the next node.
Press + to interact
struct Node {int val;Node* next;Node (int val) {this->val = val;this->next = NULL;}}
Deletion
There are 2 cases:
- Delete head
- Delete node at a given position
The worst-case for deleting a node is ...