1. A computer-implemented method for finding a best matching string among a set of strings for a reference string, the method comprising: representing, for each of the set of strings paired with the reference string, a dynamic programming problem for calculating a final alignment score as a matrix of cells, each cell representing an intermediate result to be calculated; calculating a current optimal alignment boundary threshold, for each string of the set of strings, executing: calculating a prospective final alignment score of a candidate alignment of the each of the set of strings and the reference string for each cell; based on determining, that prospective final alignment score improves the current optimal alignment boundary threshold, calculating a final alignment score for the string of the set of strings associated with the cell; and based on determining, that prospective final alignment score does not improve the current optimal alignment boundary threshold, aborting the calculation of a candidate alignment covering the string of the set of strings associated with the cell, wherein the optimum alignment score value for each of the cells is calculated as MATCHES * BEST_MATCH+GAPPENALTY(gaps), wherein MATCHES =min(M−(j+1), N−(i+1)), wherein the MATCHES parameter value is the maximum possible number of matching character pairs in the sub-alignment, BEST_MATCH is the highest score obtainable for any aligned character pair for maximizing functions or the smallest obtainable score for minimizing functions, gaps is a minimum possible number of gaps occurring in the sub-alignment; and GAPPENALTY(gaps) is a monotone function which for a given number of gaps that is greater than zero that returns a penalty cost, the penalty cost being a negative value for maximizing functions and being a positive value for minimizing functions.