merge sorted array
gray code