merge algorithm case output