The sublists are of length k, therefore insertion sort takes k^2
for each sublist. now, there are n/k
sublists in total, so, n/k
* k^2
is nk
. The key understanding here is that there are n/k
number of sublists, and insertion sort takes k^2
time to sort each one.
Another thing to note, is that knowing that merge sort has O(n logn)
is actually not important at all to this problem, because they don't ask for the time for sorting the whole list, just the time for sorting all of the sublists.