merge to sorted array