Current browse context:
cs.DS
Change to browse by:
References & Citations
Computer Science > Data Structures and Algorithms
Title: A Complete Worst-Case Analysis of Heapsort with Experimental Verification of Its Results, A manuscript (MS)
(Submitted on 7 Apr 2015)
Abstract: A rigorous proof is presented that the number of comparisons of keys performed in the worst case by ${\tt Heapsort}$ on any array of size $N \geq 2$ is equal to: $ 2 (N-1)\, ( \, \lg \frac{N-1}{2} +\varepsilon \, ) - 2s_2(N) - e_2(N) + \min (\lfloor \lg (N-1) \rfloor, 2) + 6 + c, $ where $ \varepsilon $, given by: $\varepsilon = 1 + \lceil \lg \, (N-1) \rceil - \lg \, (N-1) - 2^{\lceil \lg \, (N-1) \rceil - \lg \, (N-1)} ,$ is a function of $ N $ with the minimum value 0 and and the supremum value $\delta = 1 - \lg e + \lg \lg e \approx 0.0860713320559342$, $s_2(N)$ is the sum of all digits of the binary representation of $N$, $e_2(N)$ is the exponent of $2$ in the prime factorization of $N$, and $ c $ is a binary function on the set of integers defined by: $c = 1$, if $N \leq 2 ^{\lceil \lg N \rceil} - 4$, and $c = 0$, otherwise. An algorithm that generates worst-case input arrays of any size $ N \geq 2 $ for ${\tt Heapsort}$ is offered. The algorithm has been implemented in Java, runs in $O( N \log N )$ time, and allows for precise experimental verification of the above formula.
Link back to: arXiv, form interface, contact.