Theoretical average case runtime complexity of `numpy.argmax()`

Viewed 1345
1 Answers

Here is a performance analysis using benchit:

def m(x):
  return np.argmax(x)

in_ = [np.random.rand(n) for n in [10,100,1000,10000]]

As you can see it is O(N) as it should be. You iterate over array once to find the maximum.

enter image description here

Related