What’s the difference between external sorting and internal sorting? I don’t see how wether the input data can be stored in RAM or not has to do with the algorithm.
What’s the difference between external sorting and internal sorting? I don’t see how wether
Share
In internal sorting all the data to sort is stored in memory at all times while sorting is in progress. In external sorting data is stored outside memory (like on disk) and only loaded into memory in small chunks. External sorting is usually applied in cases when data can’t fit into memory entirely.
So in internal sorting you can do something like shell sort – just access whatever array elements you want at whatever moment you want. You can’t do that in external sorting – the array is not entirely in memory, so you can’t just randomly access any element in memory and accessing it randomly on disk is usually extremely slow. The external sorting algorithm has to deal with loading and unloading chunks of data in optimal manner.