What is the scale of time complexity of this algorithm?

I have a list of list, in different length, and my algorithm runs on every element in the sub lists.

What should be my time complexity?

I don’t know if it’s okay to write O(n * m), as n length of parent list and m is the average length of t
E sub lists, or maybe O(n) as n is the number of total elements.

Please explain what the meaning of the symbols (for example n is the length of the parent list).

>Solution :

If you have n sublists with m elements each, n*m represents the total number of elements being processed, hence it has a complexity of O(n*m).

If your sublists have an unequal number of elements, it is okay to summarise it as O(N), where N is the total number of elements in the array.

Leave a Reply