In the worst case, the total number of comparisons for Bubble Sort is closest to:
n^2/2nn^2n/2n/42n^22nn^2/4Bubble Sort's implementation is made up of two nested for loops.
The outer for loop is executed n-1 times.
The inner for loop is executed i times.
The total cost is the sum of i's
for i goes from 1 to n.