CS 1301 – Ch 6, Handout 1

comparisons are made. Thus, the complexity is O n 2 . Note that even in the best case when the data is initially sorted, it still takes 1 2 n 2 - 1 2 n comparisons. Thus, the best, average, and worse case complexity are all the same, O n 2 . ................
................