reverse function is implemented without using intermediate address array.