Linked_Lists_Cpp_Notes
Linked_Lists_Cpp_Notes
A singly linked list is a linear data structure where each element (node) points to the next.
Operations:
- Traversal
Time Complexity:
- Search: O(n)
- Deletion: O(n)
struct Node {
int data;
Node* next;
};
Each node has two pointers: one pointing to the next node and one to the previous.
Operations:
Linked Lists in C++ - Notes (Singly, Doubly, Circular)
Time Complexity:
- Search: O(n)
struct Node {
int data;
Node* prev;
Node* next;
};
In a circular linked list, the last node points back to the head. Can be singly or doubly circular.
Operations:
Time Complexity:
struct Node {
int data;
Node* next;
};