Thompson Thompson - 1 year ago 92
C++ Question

Exchange sort number of comparisons and exchanges

I just have a simple question for the day, I have been looking online for some sort of formula that calculates the number of comparisons and exchanges for exchange sort. I know for selection sort the average number of comparisons would be n(n-1)/2

Answer Source

According to this page, exchange sort has a time complexity of O(n^2).