Tortoise and Hare Algorithm

The Tortoise and Hare Algorithm (also known as Floyd's Cycle-Finding Algorithm) is a two-pointer technique used in linked lists. In this animation, we'll use it to find the middle element of a linked list.

The "tortoise" (slow pointer) moves one step at a time, while the "hare" (fast pointer) moves two steps at a time. When the hare reaches the end of the list, the tortoise will be at the middle element.

Initial state: Tortoise and Hare start at the first node