Sorted() (Timsort) time complexity with lambda function as key

334 Views Asked by At

If I have the function sorted(points, key=lambda point: point[axis]), is the time complexity still O(nlogn)?

I know that sorted() uses Timsort which has this Big-O time complexity for the average case but I am not sure how the lambda function adds to that. Returning a value is O(1) but this should be called for every element, so n times.

Does that mean that the time complexity is O(n) + O(nlogn)?

0

There are 0 best solutions below