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:

    Personal change, growth, development, identity formation—these tasks that once were thought to belong to childhood and adolescence alone now are recognized as part of adult life as well. Gone is the belief that adulthood is, or ought to be, a time of internal peace and comfort, that growing pains belong only to the young; gone the belief that these are marker events—a job, a mate, a child—through which we will pass into a life of relative ease.
    Lillian Breslow Rubin (20th century)

    The most general deficiency in our sort of culture and education is gradually dawning on me: no one learns, no one strives towards, no one teaches—enduring loneliness.
    Friedrich Nietzsche (1844–1900)