Average-Case Analysis – Due in 2 hours

 

Use the copy-and-paste method to give an average-case analysis for the sort function in sort.cpp.

  • Assume that, for an input array of nn elements, on average n−−√n elements will be out of order.
  • Assume that the out-of-order elements have values that are uniformly randomly selected between the smallest and largest values of the properly-ordered members of the array. In other words, an out-of-order element is equally likely to belong to any position in the array.
  • Show all work!
  • Remember that you are doing average case analysis.
    If, at some point, you don’t ask how the average case behavior differs from the worst case behavior, you’re doing it wrong!

Please fill out chart in excel attached and add comments next to the lines in the cpp file

Tags: No tags