Concept Flow - Find Middle Element of Linked List
Start at head
Initialize two pointers: slow, fast
Check: fast != null and fast.next != null?
NoāStop
Yes
Move slow by 1 node
Move fast by 2 nodes
Repeat check
Back to Check
slow now points to middle node
Return slow
Done
ā©Back to Check
Two pointers move through the list: slow moves one step, fast moves two steps. When fast reaches the end, slow is at the middle.
