Elementary yet Precise Best-Case Analysis of MergeSort with an Application to the Sum of Digits Problem

An exact formula B(n)=n2(⌊lgn⌋+1)−∑k=0⌊lgn⌋2kZigzag(n2k+1), where Zigzag(x)=min(x−⌊x⌋,⌈x⌉−x), for the minimum number B(n) of comparisons of keys performed by MergeSort on an n-element array is derived and analyzed. The said formula is less complex than any other known formula for the same and can be evaluated in O(logc) time, where c is a constant. It is shown that there is no closed-form formula for the above. Other variants for B(n) are described as well. Since the recurrence relation for the minimum number of comparisons of keys for MergeSort is identical with a recurrence relation for the number of 1s in binary expansions of all integers between 0 and n (exclusively), the above results extend to the sum of binary digits problem.

Authors

Institutions

Publication Details

Journal
Mathematics
Published
2026-02-21
DOI
https://doi.org/10.3390/math14040733
Primary Topic
graph theory and CDMA systems
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Elementary yet Precise Best-Case Analysis of MergeSort with an Application to the Sum of Digits Problem

Marek A. Suchenek
Mathematics
graph theory and CDMA systems
article

Elementary yet Precise Best-Case Analysis of MergeSort with an Application to the Sum of Digits Problem

Marek A. Suchenek
article en

Abstract

An exact formula B(n)=n2(⌊lgn⌋+1)−∑k=0⌊lgn⌋2kZigzag(n2k+1), where Zigzag(x)=min(x−⌊x⌋,⌈x⌉−x), for the minimum number B(n) of comparisons of keys performed by MergeSort on an n-element array is derived and analyzed. The said formula is less complex than any other known formula for the same and can be evaluated in O(logc) time, where c is a constant. It is shown that there is no closed-form formula for the above. Other variants for B(n) are described as well. Since the recurrence relation for the minimum number of comparisons of keys for MergeSort is identical with a recurrence relation for the number of 1s in binary expansions of all integers between 0 and n (exclusively), the above results extend to the sum of binary digits problem.

MathematicsVol. 14(4)
California State University, Dominguez Hills (US)
Openalex Percentile: Top 48%
graph theory and CDMA systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Elementary yet Precise Best-Case Analysis of MergeSort with an Application to the Sum of Digits Problem — Marek A. Suchenek · Mathematics (2026) | TGRS Research Map | TGRS