added the code which segregates the even and odd valued nodes and append the even to odd in the same order in which they appear