static int dfs(SuffixTree.Node node) { if (node.numChildren() == 0) { return 0; } int largest = node.toString().length(); for (SuffixTree.Edge edge : node) { largest = Math.max(dfs(edge.end), largest); } return largest; }
static String dfs2(SuffixTree.Node node, int generalLargest) { int currentPointer = generalLargest - 1; char symbolisis = '$'; String largestString = "", buildString = node.toString() + " " + node.numChildren(); if (node.toString().length() == generalLargest) if (node.toString().charAt(currentPointer) != symbolisis) { return buildString; } for (SuffixTree.Edge edge : node) { largestString = dfs2(edge.end, generalLargest); if (checkSize(largestString.length(), generalLargest)) { break; } } return largestString; }