In first two passes we will get the larger elements at the end of the array so it wil take (n-1)+(n-2) comparisons.
(n-1)+(n-2)=O(n)+O(n).
If the condition is not satisfying the first pair i.e last two elements after two passes then the condition wil never be satisfied for the remaining pairs .So we can stop the bubble sort after two passes.