@StefanPochmann @livelearn Would you please elaborate why the running time is O(m+n)*min(m,n)*k ?

I am bit of confused where you get O(m+n)*min(m,n) for the merge function.

the a and b in merge function merge(a,b) sums up to k right? a+ b = k because the prep function returns out[:k]. I am guessing it should be O(k) for every position in temp and min(m,n) because the max() function?

I am so confused because there are comments above say running time is O((m+n)^3) ? I was thinking it should be O(m+n) because of prep function. and O(k) * min(m,n) *k for merge function, there is also a max() function in the return statement which runs in O(k^2) right? cause the generator have k elements in it with k length?

total would be O(m+n) + O(k) * min(m,n) *k + O(k^2) ? I am so lost.....I been thinking about this for hours. Someone please help