external sorting sample code