Recently while reading a book I came across the following statement:Mergesort works by dividing nodes in half at each level until the number of nodes becomes 1 hence total number of times we would need to do this would be $\lceil\log_{2}{n}\rceil$ and for each level we perform $O(n)$ work hence total time taken will be $O(n \log n)$How to understand the above statement? Also, I am always confused about when to take ceil or floor.
How to calculate the mergesort time complexity?
algorithm analysis;runtime analysis;sorting;recursion