I will assume that by depth, you mean the number of levels of partitioning (splitting the components into two parts) that merge sort performs.
If this is the case, the algorithm for finding the depth should not be "log2(n) + 1", but rather the ceiling of "log2(n)" (the ceiling function rounds numbers up to the nearest whole number).
This is because there are two types of inputs you can start with:
- When "n" is a power of 2.
- When "n" is not a power of 2.
In the first case, you can keep partitioning the input into components until you reach components of size 1. At this stage there can be no more partitioning and the number of levels of partitioning is a whole number. Thus the answer is not affected by the ceiling function.
In the second case, you can partition the input into components however you will arrive at a stage when some inputs have components of size 2 as well as components of size 1. This is represented in the logarithm by the decimal numbers when you calculate "log2(n)". Obviously you cannot take a fraction of a step, so the ceiling function rounds it up to the next whole number.
TLDR: "ceiling(log2(n))" instead of "log2(n) + 1"
Note that in this answer I do not consider the root level as a level of partitioning. If I did wish to, I would simply "+1" to the ceiling.