Release:2017, Vol. 3. №2
About the authors:Ivan N. Tkachenko, Senior Software Engineer, Ltd. «Technocom» (Tyumen); email@example.com
This article explores the ways of sorting the jagged arrays for ordering rows in descending order by two criteria. A jagged array is a representation of the solutions of the problem of finding the optimal path, in which each row is one of the solutions. The purpose of sorting is to select the most significant solutions and then reduce the number of objects stored in the reachability matrix. Reducing the number of objects does not affect the dimensionality of the reachability matrix, but reduces the amount of memory needed to store the cells of the matrix. The task is described on the example of assessing the solutions to the transport task of cargo delivery. In the article, when sorting rows of jagged arrays, the priority of some cells of the array row is assumed over the others, that is, the first cell exerts a greater value on the result than the second, and the second cell has more than the third, etc.
The result of the study is the formalization of the rules of eight different approaches to sorting — by the number of variants of combining the two sorting criteria, the algorithm is given and the estimation of computational complexity is given. The criteria for sorting are the key length and key value. All eight approaches provide different sorting results. For each approach, the operations necessary to achieve the desired result are described and analyzed with provided examples. In each case, a problem is formulated and formalized.
The algorithm for sorting the jagged arrays is based on generating a text representation of the row key. The article only considers sorting rows, sorting columns in the article is not considered.
Conclusions are drawn about which of the described approaches provide the best sorting speed and why. On the example of the problem of cargo transportation, it is described to what effect the choice of this or that approach to sorting will result.