Big O: is the overall performance of `IterateArray` O(n) or O(n log n)?

big-o, performance

Solution

The short & somewhat wrong answer is O(n log n).

The long answer: It'd be more accurate to write it as O(n log m).

Unless DoSomething really DOES depend on the entire array, it looks like it's operating on a single element. So we distinguish this separately, using "m".

Problem

If I have the following code: ``` IterateArray(object[] array) { for(int i=0; i<array.length; i++) { Dosomething(array[i]); } } ``` and the `Dosomething(object)` method's time performance is O(log n), is the overall performance of `IterateArray` O(n) or O(n log n)?

Original source