Not O(1) space but O(height of tree) space.