The analysis of merge sort is straightforward. Consider the following array of 8 elements.
- 4
- 0
- 12
- 2
- 14
- 5
- 10
- 11
- 4
- 0
- 12
- 2
- 14
- 5
- 10
- 11
Splitting Work
|----------- n -----------|
- 4
- 0
- 12
- 2
|--- n2 ---|
- 4
- 0
|- n4 -|
Merging Work
n8
n8
- 12
- 2
|- n4 -|
n8
n8
|--- n2 ---|
- 14
- 5
- 10
- 11
|--- n2 ---|
- 14
- 5
|- n4 -|
n8
n8
- 10
- 11
|- n4 -|
n8
n8
|--- n2 ---|
|----------- n -----------|
|--------------- logn+1---------------|