Big O notation in python
问题 Does anyone know of any good resources to learn big o notation? In particular learning how to walk through some code and being able to see that it would be O(N^2) or O(logN)? Preferably something that can tell me why a code like this is equal to O(N log N) def complex(numbers): N = len(numbers) result = 0 for i in range(N): j = 1 while j < N: result += numbers[i]*numbers[j] j = j*2 return result Thanks! 回答1: To start, let me define to you what O(N log N) is. It means, that the program will