private static void traverseTrie(TrieNode node, char letter, ArrayList<Character> word, int[] previousRow, Trie theTrie) {

        int size = previousRow.length;
        int[] currentRow = new int[size];
        currentRow[0] = previousRow[0] + 1;

        int minimumElement = currentRow[0];
        int insertCost, deleteCost, replaceCost;

        for (int i = 1; i < size; i++) {

            insertCost = currentRow[i - 1] + 1;
            deleteCost = previousRow[i] + 1;

            if (word.get(i - 1) == letter) {
                replaceCost = previousRow[i - 1];
            } else {
                replaceCost = previousRow[i - 1] + 1;
            }

            currentRow[i] = Math.min(Math.min(insertCost, deleteCost), replaceCost);

            if (currentRow[i] < minimumElement) {
                minimumElement = currentRow[i];
            }
        }

        if (currentRow[size - 1] < theTrie.minLevDist && node.isWord) {
            theTrie.minLevDist = currentRow[size - 1];
        }

        if (minimumElement < theTrie.minLevDist) {

            for (Character c : node.children.keySet()) {
                traverseTrie(node.children.get(c), c, word, currentRow, theTrie);
            }
        }
    }