Let's assume I have a list of some words found in the English dictionary: ["hat", "assume", "prepare", "cat", "ball", "brave", "help" .... ]
I want to sort these words (which are n in number) in a way, such that they are ordered based on their length, but if 2 words have the same length, they are ordered alphabetically.
What is the time complexity of this sorting operation?
Would it be fair to say that the complexity is just O(nlogn) and not take into consideration the length of the strings? If the largest length is S
, can the complexity also involve a factor of S?