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:
“We all run on two clocks. One is the outside clock, which ticks away our decades and brings us ceaselessly to the dry season. The other is the inside clock, where you are your own timekeeper and determine your own chronology, your own internal weather and your own rate of living. Sometimes the inner clock runs itself out long before the outer one, and you see a dead man going through the motions of living.”
—Max Lerner (b. 1902)
“Ive spoiled Jemima in more ways than one.
Shes got so she turns in at every house
As if she had some sort of curvature,
No matter if I have no errand there.
She thinks Im sociable. I maybe am.”
—Robert Frost (18741963)