First iteration of Outer loop ---------------> n-1 comparisions
Second iteration of Outer loop ----------> n-2 comparisions (Since largest element has gone to its proper place)
Third iteration of Outer loop--------------->n-3 comparisions (Since two largest elements has gone to their proper places)
Total number of comparisions = (n-1)+(n-2)+(n-3)+............+1 = n(n-1) / 2 = O(n^2)
Option D.