sort merge algorithm