external sorting algorithm