I am trying to evaluate the effectiveness of a function where the input is an array of strings. The algorithm always iterates through each element of this array. These strings contained in this array are of variable length. In this initial loop, the character invocation function is called for each line. I believe that the replacement function itself will be O (n), where n is the length of the string.
So, I am confused how to evaluate the great efficiency here. If n is the size of the array, I know that it will be at least O (n). But with variable string lengths, how would you rate overall efficiency when replacing a string? Would you say that n is the size of the array and the use of other variables to represent the different sizes of each row?
source
share