-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Description
In the following function:
private HashSet<string> Edits(string word, int editDistance, HashSet<string> deleteWords)
{
editDistance++;
if (word.Length > 1)
{
for (int i = 0; i < word.Length; i++)
{
string delete = word.Remove(i, 1);
if (deleteWords.Add(delete))
{
//recursion, if maximum edit distance not yet reached
if (editDistance < maxDictionaryEditDistance) Edits(delete, editDistance, deleteWords);
}
}
}
return deleteWords;
}
Would it make sense to only add to calculate and add the words to deleteWords if editDistance < maxDictionaryEditDistance is true? That is quite a difference in loading dictionary performance. It does change the functionality, but isn't that the correct approach not to add the words anyhow?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels