Abstract [eng] |
Six most used sorting algorithms (two from each of the three main groups: selection, insertion, and exchange) were analysed. Specifically, in the selection group – Selection Sort and Double Selection Sort, in the insertion group – Insertion Sort and Shell Sort, in the exchange group – Bubble Sort and Gnome Sort were analysed. These algorithms were compared by the amount of compares and swaps as well as sorting time. By using C++ Builder three programs necessary for analysis were created: one for data generation, another for examination of separate algorithms, and the main program that returns sorting parameters. The data are generated in Int type (Integer number), Float type (Floating- point number) and Char type (alphabet). The data are generated by the number of values, for the generation of numbers we can appoint the range and so we can make files with different levels of data such as an almost sorted row or, on the contrary, a very scattered one. The program for examination of separate algorithms sorts data and after every swap writes a string of values in the text box, so we can follow the work of separate algorithms and we can see how different they are. And the main program sorts values by data type and returns only amount of compares, swaps and sorting time. Tables with these results were used to build diagrams and charts for comparisons of algorithms. Keywords: algorithms, sorting. |