prev
to None
and cur
to head
.cur
reaches the left
th node, updating prev
and cur
.con
(the node before left
) and tail
(the left
th node).left
to right
, reversing the links by pointing cur.next
to prev
.prev
and cur
to the next nodes in the list.con
and tail
.con
is not None
, point con.next
to prev
, otherwise set head
to prev
.tail.next
to cur
to connect the end of the reversed sublist to the remaining list.