Analyzing the Merge Sort Algorithm
- In an array of size n, count how many times an array
element is visited
- Assume n is a power of 2: n = 2m
- Calculate the number of visits to create the two sub-arrays and
then merge the two sorted arrays
- 3 visits to merge each element or 3n visits
- 2n visits to create the two sub-arrays
- total of 5n visits