update the solution of Morris Traversal