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:

    If the Revolution has the right to destroy bridges and art monuments whenever necessary, it will stop still less from laying its hand on any tendency in art which, no matter how great its achievement in form, threatens to disintegrate the revolutionary environment or to arouse the internal forces of the Revolution, that is, the proletariat, the peasantry and the intelligentsia, to a hostile opposition to one another. Our standard is, clearly, political, imperative and intolerant.
    Leon Trotsky (1879–1940)

    Who knows what sort of seventeen-year locust will next come out of the ground?
    Henry David Thoreau (1817–1862)