TOOLS FOR COMPARING THE RESULTS OF THE WORK OF SORTING ALGORITHMS

The program implementation of sorting algorithms is obtained. The program realization of complex for comparison of sorting algorithms is obtained. Using the obtained tools, an analysis of algorithms for sorting by speed was performed depending on the number of members of the data array.


Introduction
Often, there is a need to arrange objects based on a single quality: to record number's data in ascending order, arrange people by their height, arrange words in alphabetical order.If you are able to compare any two items from the given set, then this set can always be arranged.The process of organizing information is called "sorting".
The volumes of data arrays reach the sizes that decades ago seemed almost unbelievable.The need to organize large amounts of information that is used to effectively implement a real-time search and processing procedure is increasing.The larger the amount of processed data, the more important is the task of optimizing the algorithms used, including sorting.
Thus, the development and research of methods for sorting data arrays, presenting them in a more convenient and formalized form with subsequent implementation is an urgent task at the present stage of development of high-performance computing instruments.
The purpose of this work is to develop a software package for comparing the results of the algorithms of sorting.The creation of a complex includes the development of algorithms and software for comparing the results of the algorithms of sorting.

Problem statement
In the development of tools (software complex) the most common algorithms for data sorting have been analysed.Due to the analysis conducted for the program implementation, the following sorting algorithms were selected:  Built-in sorting algorithm (Python),  Quicksort (Hoare sorting),  Merge sort,  Heapsort (pyramid sort),  Binary insertion sort,  Sorting by using simple (linear) inserts,  Shell sort,  Sort by choice,  Bubble sort,  Threaded sort,  Bin sort (Bucket sort),  Integer sort (Radix sort).
For program realization of selected algorithms scripting programming language is being used.
The scripting languages are used by themselves as complete base tool platforms more frequently.For example, many large commercial applications are now programmed mainly in Perl, PHP or Python.Python belongs to a dynamic typing language class, provides the programmer with an automatic "garbage collection" and convenient high-level data structures, such as dictionaries, lists, tuples, etc. Python combines striking power with a simple and understandable syntax, thought-out modularity and scalability.
The Python language interpreter is freely distributed under the Python Software Foundation (PSF) License, which is to some extent even more democratic than the GNU General Public License.
For Python there are libraries for access to the DBMS (on the Windows platform, access to the DB is possible through ADO).There are extension modules for Python under Windows and Unix/Linux for access to Oracle, Sybase, Informix, MySQL and SQLite.
The implementation of tools for comparing results is done in the Delphi programming language.
For temporarily storing data about the speed of program implementation of sorting algorithms, SQLite database is selected.The program is lined up with a library and the engine becomes an integral part of the program.
SQLite stores the entire database (including definitions, tables, indexes, and data) in a single standard file on the computer that is running the program.
Database Management System "SQLite" is a program that is provided under "open source" terms.
The SQLite library itself is written in C and is included in the Python installation application.A number of wrappers and components have been developed to work with Delphi.To implement the Delphi-SQLite connection, the ZeosLIB components have been selected.
ZeosLib is an open source project that supports multiple database management systems for Delphi, FreePascal, Kylix and BCBuilder: MySQL, PostgreSQL, Interbase, Firebird, MS SQL, Sybase, Oracle, SQLite.ZeosLib uses native DBMS libraries, but can also use its own modified libraries.Usually it's used for configuring and linking components to each other and the host.
The software implementation of the selected algorithms has been carried out in the programming language Python version 3.4.3.SQLite3 database version 3.7.0.1 was used to save data.
To save the data of calculation of the sorting algorithm time to obtain information about the average, median, and fashion, we use the box_plot database table box created using the SQLite3 DBMS.
The table structure is designed to store the data of ten runs of each sorting algorithm with a fixed value of the number of members of the Nb data array.
To analyse the obtained data a software package was developed, which includes: application for calculation (average, median, mode) and visualization of the obtained results; Application for analysis of the received data (regression equation, time) of the sorting process and their 2D and 3D visualization; an application for comparing graphs of sorting time dependence on the number of sorting elements.
Let's take a closer look at each of the applications.

Main results
Data Mining applicationhas the ability to download data from the box's database, namely the box_plot table, display it in tabular form, calculate the average, median, mode, maximum value and minimum value, and visualize this data in the form of a graph (Figure 1).
The application Chart_m is intended to calculate the total sorting time, creating the sorting time graphical dependence on the number of array elements for this sorting method (2D and 3D), maintaining the obtained dependence into the BMP file, and printing the received results (Figure 2).
The Charts application is designed to construct sorting time dependencies on the number of members of the sorting array for different sorting methods (Figure 3).
For each testing algorithm, a preliminary analysis of how much time algorithms work, depending on the size of the input data, was carried out.
It has been found by the research that all sorting algorithms, except for threaded sort, sorting by choice, sorting by simple inserts, and "bubble" sorting, work fairly quickly.For fast algorithms (built-in sort, integer sort, bucket sort, etc.) testing with incoming data up to 1,500,000 entries was performed; for others (that work slowly)this limit was up to 110000 entries.
From the analysed data the results of the complexity of each algorithm are obtained.
Table 1 shows the dependence of the working time (sec.) on the number of elements sorted by different algorithms (complexity of the algorithm).The language of implementation is Python.The following table shows that the following sorting algorithms: threaded sort, sort by choice, simple inserts, "bubble" sort, work very long in comparison with others.
The graph of the time dependence of these algorithms on the number of elements sorted is as follows (Figure 4).
From the graph it is noticeable that the algorithm of "threaded sort" is considerably inferior to others (more than 2 times).
Let's consider the running time of other algorithms.We will start with the algorithm of binary inserts.The graph of the time dependence of this algorithm looks like this(Figure 5).
We describe the resulting curve by the equation of the form y = ax b .We get y = 1.736E-8•x^1.77365.We give the similarly calculated dependencies in the four previous algorithms and in the binary insertion algorithm in Table 2.The binary insertion algorithm works faster than the previous four also because the constant b in this algorithm is smaller.
Let's consider a series of fast algorithms: quicksort, merge sort, Shell sort, pyramid sort (Figure 6).

Fig. 4 .Fig. 5 .
Fig. 4. Nonlinear dependence of the algorithm's running time on the number of elements that are sorted.The following algorithms are presented in the graph: 1 -Threaded sorting, 2 -Sort by choice, 3 -Simple inserts, 4 -Bubble sort Table 2. Dependencies of the forms y = ax b for sorting algorithms

Table 1 .
Dependence of the working time (sec.) on the number of elements sorted by different algorithms