Let us say, the relatively small sequence of casual data are sorting out in memory by anything comfortable for these aims algorithm, for example, by the quick sort algorithm. If basic data are not presented as a few Ordered SubSequences which we will name OSS too, such OSS should be got, that is be split by any way. This method chooses a maximal or minimum value consistently from data queues and writes it down in the sought-for sequence. It is known that the Merge Sort method is comfortable for the general sorting of a few long ordered subsequences. As for Win32, the size of long integer equals 32 bits or 4 bytes, we need be increase the field length in bytes yet on 4 bytes. Really, we will yet interest to the row number of every string data field for the purpose of indexing. As we were not going to modify the source of data, for sorting of one data column, we may have needed two file buffers, their sizes being equal to the amount of data multiplied into the length of field of data. So, we were determined, that we were interested by an algorithm of external sort. Therefore, we will make an effort to decide on this task in the indicated formulation. There are cases, when it is not desirable without an absolute necessity to attract external programs for your own programs which are not very difficult. Here, we will not discuss whether it is needed or not needed to do the similar sorting, when there exists a great number of software products, especially oriented to work with databases, and are already doing this well enough. A sorting purpose is a creation of index file for one or a few the fields of data. In my case, this was the necessity of the independent sorting of string data from the set column of tabular database (concretely dbf file) in an external file buffer, i.e., sorting on determination must be external because a source file can be large enough (gigabyte and more) and in addition sorting can be carried out for a few columns simultaneously. Possibly, the experience of the author in this area can appear useful to someone therefore, we will describe our researches and practical results.Īlthough usually choosing a concrete algorithm of sorting is an arduous duty, it is fully possible to be determined with a class of algorithms, depending on a given task. Secondly, there is always a problem of realization as it applies to a practical task. As the saying goes, every algorithm is good in its own fashion. Indeed, how to choose the best, especially as clear recommendations are not present. Not looking at that, this theme is well investigated and there are many wonderful sorting algorithms, there are some nuances at their practical use. Sooner or later, any programmer runs into the necessity of the obvious use of one or the other method of sorting. A similar algorithm has been already published in Russian on my site.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |