title: Average case complexity analysis of insertion and bubble sort
body: <p>This site already has some questions on this topic but I am confused after reading some of the answers.</p>
  
  <p><a href="https://cs.stackexchange.com/questions/20/evaluating-the-average-time-complexity-of-a-given-bubblesort-algorithm">https://cs.stackexchange.com/questions/20/evaluating-the-average-time-complexity-of-a-given-bubblesort-algorithm</a></p>
  
  <p>In the above link, answer by "Joe" says that number of swaps in bubble sort on average is same as number of inversions on average which is (n)(n-1) / 4.</p>
  
  <p>However, <a href="https://stackoverflow.com/questions/17270628/insertion-sort-vs-bubble-sort-algorithms">Insertion sort vs Bubble Sort Algorithms</a> says that in bubble sort average number of swaps is n^2 /2 and in insertion sort it is n^2/4 and that's the reason for insertion sort being better than bubble sort.</p>
  
  <p>Which one is correct? Can someone please help me?</p>