Concept
Two pointers move through a list at different speeds. If there is a cycle the fast one laps the slow one; otherwise when the fast one reaches the end the slow one is at the middle.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Fast and slow pointers doing its job.
def middle(head):
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
return slow
def has_cycle(head):
slow = fast = head
while fast and fast.next:
slow, fast = slow.next, fast.next.next
if slow is fast:
return True
return FalseChecking only fast and not fast.next before advancing two steps. On an even-length list fast becomes None one step early and fast.next.next raises AttributeError.
Your roadmap puts these before Fast and slow pointers, unless you already know them.
Once a session shows you understand Fast and slow pointers, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.