Member-only story
Linked List — Core Operations
4 min readJul 1, 2025
The most important core operations for each type of linked list include:
- Insert (at beginning, end, middle)
- Delete (from beginning, end, specific node)
- Display / Traverse
- Empty check
- Other useful operations like search, count, and reverse
1. Singly Linked List (SLL)
A. Structure
struct Node {
int data;
struct Node* next;
};B. Core Operations
1. Insert at Beginning
void insertAtHead(struct Node** head, int val) {
struct Node* newNode = malloc(sizeof(struct Node));
newNode->data = val;
newNode->next = *head;
*head = newNode;
}2. Insert at End
void insertAtEnd(struct Node** head, int val) {
struct Node* newNode = malloc(sizeof(struct Node));
newNode->data = val;
newNode->next = NULL;
if (*head == NULL) {
*head = newNode;
return;
}
struct Node* temp = *head;
while (temp->next) temp = temp->next;
temp->next = newNode;
}3. Delete from Beginning
void deleteFromHead(struct Node** head) {
if (*head == NULL) return;
struct Node* temp = *head;
*head = (*head)->next;
free(temp);
}







