Doubt on the formula and vote

As I can see a quadratic function is used to relate the word length and the comparisons which can be read as:
“The number of comparisons (Y) depends on the word length (X)”.

However I failed to understand part of the mathematical model that was created:

N^2 --> since we have 2 blocks of comparisons.
-N —> since we have to deduct the letters that get repeated

I don’t understand quite well why do I have to divide all by 2, I assume that it is related to the number of blocks which are two but it feels a little bit fuzzy, above all when we “square n” to get both blocks.


When it comes to the vote, I would vote none because at first sight:

… creating a class Word which inherits letters… letters that have a boolean “repeated” attribute and a counter, if the counter increases to 1 or more, then the repeated attribute is true and the word is not an isogram

OR

… creating a class Word with letters as structs that follow the same patern as above.

(all that considering that an FBullCowGame has a Word, an array of words or a collection of words as reference types and attributes of the class)

…makes more sense to me. But assuming I’m wrong or my method is not well suggested and apart from that, we compulsory need to sort the word before looking for duplicates (my method above is only centered on finding duplicates) I would use either quick sort or bubble sort

Becasue quick sort is the fastest sorting algorithmn AFAIK, however it has recursivity which for me it is a pain in the ass, I’m more fond of iterations than using the recursive standard.

Bubble sort because is pretty easy to digest, it’s non-recursive and assuming we don’t have a 999999999999999 letter isogram, it’s programmer friendly and pretty much gets the job done for this game.

I vote for bubble sort as the sorting algorithmn this time.

If you can better explain all this (on how the mathematical model for the quadratic function was created AND how is it compulsory to sort the words) I would be thankful.

Greetings in advance, community

Privacy & Terms