What is the difference between external sorting and internal sorting?

What is the difference between external sorting and internal sorting? I do not see how it is possible to store the source data in RAM or not, but this is not related to the algorithm.

+7
source share
1 answer

In internal sorting, all sorting data is stored in memory all the time during sorting. In external sorting, data is stored out of memory (for example, on disk) and loaded only into memory in small pieces. External sorting is usually used in cases where the data cannot be fully written into memory.

Thus, in internal sorting, you can do something like shell sort - just get access to any elements of the array that you want, at any time you want. You cannot do this in external sorting — the array is not completely in memory, so you cannot just accidentally access any element in memory and get it accidentally on disk, usually extremely slowly. An external sorting algorithm should deal with loading and unloading data blocks in an optimal way.

+9
source

All Articles