def find_middle(self): if not self._head or self._head.next is None: return self._head fast, slow = self._head, self._head fast = fast.next while fast and fast.next: slow = slow.next fast = fast.next.next return slow