SLLs
SLLs, short for singly linked lists, are a class of linear data structures composed of nodes. Each node contains two fields: a data element and a reference to the next node in the sequence. The list is accessed via a reference to the first node, called the head. The final node’s next reference typically points to null, indicating the end of the list. Some variants are circular, where the last node points back to the head.
- Traversal: starting at the head, follow next references until reaching null (or the loop in circular
- Insertion: can be performed at the head in constant time, or after a specified node in constant
- Deletion: removing the head is O(1); deleting after a given node is O(1) if the previous node
- Access time for a specific position is O(n) since nodes must be traversed sequentially.
- SLLs use dynamic memory and do not require contiguous storage, but each node carries an extra
- Variants include circular singly linked lists and the use of a dummy head (sentinel) to simplify
SLLs are well-suited for scenarios requiring frequent insertions and deletions, such as stacks, queues, or dynamic