Software Engineer (SDE)dsabeginner3 interactive MCQs in app
Singly Linked List: Insert, Delete & Reverse
pointer rewiring during reversalO(n) traversal vs O(1) known-position splicenull/head boundary cases
Core Concept
A singly linked list links nodes via next pointers instead of contiguous memory. Access to the k-th node is O(k), while inserting or deleting a node is O(1) once you hold a pointer to the previous node.
Worked Example
(in-place reversal) maintain prev=null, curr=head; each step save nxt=curr.next, point curr.next=prev, then advance prev=curr, curr=nxt.
Common Pitfall
overwriting curr.next before saving next breaks the remainder of the list; omitting dummy heads complicates deleting node 0.
Recommended Readings & Practice
Practice Singly Linked List: Insert, Delete & Reverse with 3 graded MCQs & written feedback.
Take SOARDO’s free 12-question diagnostic to see how strong you are across your target role and unlock adaptive daily missions.