You are on page 1of 8

Page 1 of 8

Complexity Analysis – DSA


Page 2 of 8
Complexity Analysis – DSA
Page 3 of 8
Complexity Analysis – DSA
Page 4 of 8
Complexity Analysis – DSA

To count total number of steps, we must determine:

1. Step count for each statement – or s/e

2. Frequency of each statement

3. Total steps for each statement

4. Finally sum these counts to get the total step count


Page 5 of 8
Complexity Analysis – DSA
Page 6 of 8
Complexity Analysis – DSA
Page 7 of 8
Complexity Analysis – DSA
Page 8 of 8
Complexity Analysis – DSA

Merge Sort A recursive merge sort algorithm used to sort an array of 7 integer values.
These are the steps a human would take to emulate merge sort (top-down). In sorting n objects,
merge sort has an average and worst-case performance of O(n log n).

You might also like