Internal Sort

An internal sort is any data sorting process that takes place entirely within the main memory of a computer. This is possible whenever the data to be sorted is small enough to all be held in the main memory. For sorting larger datasets, it may be necessary to hold only a chunk of data in memory at a time, since it won’t all fit. The rest of the data is normally held on some larger, but slower medium, like a hard-disk. Any reading or writing of data to and from this slower media can slow the sortation process considerably. This issue has implications for different sort algorithms.

Internal Sorting algorithms are of 7 types :- Bubble Sort, Insertion Sort, Quick Sort, Heap Sort, merge Sort, Radix Sort,Selection sort. Consider a Bubblesort, where adjacent records are swapped in order to get them into the right order, so that records appear to “bubble” up and down through the dataspace. If this has to be done in chunks, then when we have sorted all the records in chunk 1, we move on to chunk 2, but we find that some of the records in chunk 1 need to “bubble through” chunk 2, and vice versa (i.e., there are records in chunk 2 that belong in chunk 1, and records in chunk 1 that belong in chunk 2 or later chunks). This will cause the chunks to be read and written back to disk many times as records cross over the boundaries between them, resulting in a considerable degradation of performance. If the data can all be held in memory as one large chunk, then this performance hit is avoided.

On the other hand, some algorithms handle external sorting rather better. A Merge sort breaks the data up into chunks, sorts the chunks by some other algorithm (maybe bubblesort or Quick sort) and then recombines the chunks two by two so that each recombined chunk is in order. This approach minimises the number or reads and writes of data-chunks from disk, and is a popular external sort method.

Famous quotes containing the words internal and/or sort:

    I have been amazed by the Anglo-Saxon’s lack of curiosity about the internal lives and emotions of the Negroes, and for that matter, any non-Anglo-Saxon peoples within our borders, above the class of unskilled labor.
    Zora Neale Hurston (1891–1960)

    There is no object so foul that intense light will not make beautiful. And the stimulus it affords to the sense, and a sort of infinitude which it hath, like space and time, make all matter gay. Even the corpse has its own beauty.
    Ralph Waldo Emerson (1803–1882)