There are many other situations where you can guess the final position of each item. Most discussions of sorting algorithms are based on comparing elements. Although it's faster to classify elements, algorithms based on classification suffer because they require considerable auxiliary memory. The Flashsort1 algorithm I present here addresses this problem. I assume here that the elements are approximately evenly distributed real numbers, although the algorithm can be adapted to other types of data.
Classification determines the size of each class of elements.
Since the main part of the algorithm relies on it, I start by computing the actual number of elements in each class. This requires simply scanning the data and counting the total number of elements. Since I know the size of each class, I can predict where each class will appear in the final array. The vector L is used to track this information. The next step is to move elements into the correct class.