I think you got it, the worst case is 3n. In "normal" bubble sort you have to make n compares n times hence the O(n^2) to get all elements sorted. In your case, since bubble sort has a side effect of having the largest element being sorted out first and you only need 3 of those, then you would at worst have to make n compares 3 times.