Simple external sort implementation