I am writing a spell corrector that gives suggestions to the user. To do this, I am using words one and two edit distance away. There are four techniques:
- deleting one letter of the word,
- transposing two neighboring letters,
- alteration of one letter of the word, and
- inserting one letter to the word.
Some of these require many iterations through the word, and doing things like swapping two letters, or adding a letter in the middle of a string.
I know String are immutable in java, and that insert from string builder might create copies of the string as necessary, so I was wondering if an array of char would make this any faster.