VISUALGO//POINTERS
fast and slow · two-pointer trace console · O(n)
Goal:Find the middle element using two pointers — slow moves 1 step, fast moves 2 steps. When fast reaches the end, slow is at the middle.
10
0
4
1
5
2
8
3
10
4
17
5
15
6
19
7
7
8
6
9
▲
SLOW,FAST
ARRAY SIZE
READOUT
step0 / 15
slow index0
fast index0
step #0
statusIDLE