update next when jumping, time O(n)