for i=1 to n k = 1 sum = 0 for j=1 to i k = 2*k; for p=1 to k sum = sum + p
Now define the flip-count of an array as the number of flips that an array has. Clearly, an array sorted in increasing order has no flips and has flip-count zero.
Submission: