Suppose we have two discrete random variables and we want perform maximum operation to obtain the max PDF.
We know that max of two independent random variables is: if Z = max(X,Y)
pr(Z = k) = pr(X = k) pr(Y < k) + pr(X < k) pr(Y = k) + pr(X = k) pr(Y=k)
My question how this operation has O(nm) timing complexity where n and m are the sample size of X and Y receptively or O(n^2) when both has n samples.
It should not be O(n)? for instance the example i've shown in picture there is 3 multiplication and 4 sums for each max sample and if we increase the number of X and Y samples to 8 the multiplications number still the same and the sums doubles so it's linear.
Could you please correct me if i'm wrong?