I’m wondering how this algorithm compares (in terms of efficiency) to the method shown in the course which uses a map:
for (int i = 0; i < strGuess.length(); i++) {
int intCount = 0;
for (int j = 0; j < strGuess.length(); j++) {
if (strGuess[i] == strGuess[j]) {
intCount++;
}
}
if (intCount > 1) {
guessStatus = EGuessStatus::Not_Isogram;
break;
}
}
It goes through each letter in the guess and compares it to all other letters in the guess; if a letter is seen more than once (i.e., ‘intCount’ > 1), then we break out of the outer loop and return the proper ‘error code’…
Bryan