sorting by merge