Middle of the Linked List — Fast and Slow Pointers
Find the middle node of a linked list in one pass using the slow/fast pointer technique.
webcoderspeed.com
10 articles
Find the middle node of a linked list in one pass using the slow/fast pointer technique.
Detect a cycle in a linked list in O(1) space using Floyd's two-pointer tortoise and hare algorithm.
Check if a linked list is a palindrome by finding the middle, reversing the second half, then comparing.
Remove the nth node from the end in one pass using two pointers offset by n steps and a dummy head.
Reorder a linked list into L0→Ln→L1→Ln-1 pattern by splitting at middle, reversing second half, then merging.
Find the node where a cycle begins using Floyd's algorithm: detect meeting point, then reset one pointer to head.
Find the duplicate in an array of n+1 integers in O(1) space by treating indices as a linked list with Floyd's cycle detection.
Find the maximum sum of twin nodes (node i + node n-1-i) by reversing the second half and comparing pairs.
Delete the middle node of a linked list using a prev-pointer variant of the fast/slow technique.
Convert a sorted linked list to a height-balanced BST by repeatedly finding the middle node as root.