
Chris T. answered 02/11/22
Senior Engineer @ Google | Former TA in operating systems
Summary: this is a recursive implementation of insertion sort, which runs in O(n2) in its average and worst cases.
Explanation:
Given that you have n calls to sort() and each call to sort() iterates through, on average, n / 2 elements, your Big-O time is thus:
O(n * (n / 2)) → O(n2)