INNER CODE UNIT · Java

cost

robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/LevenshteinUtils.java:177

                cost = source[row - 1 + sourceStart] == target[col - 1 + targetStart] ? 0 : 1;

                matrix[row][col] = min(
                        matrix[row-1][col] + 1,
                        matrix[row][col-1] + 1,
                        matrix[row-1][col-1] + cost);
            }
        }

        // Reverse trace the matrix to compute the necessary actions
        final List<Integer> resultList = new ArrayList<>(resultLength * 2);
        int row = numRows - 1;
        int col = numCols - 1;
        while (row > 0 || col > 0) {
            if (row == 0) {
                // At the top row, can only move left, meaning insert column
                resultList.add(ACTION_INSERT);
                col--;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…