A Complete Worst-Case Analysis of Heapsort with Experimental Verification of Its Results, A manuscript (MS)

Abstract

A rigorous proof is presented that the number of comparisons of keys performed in the worst case by Heapsort on any array of size N ≥ 2 is equal to: 2 (N-1)\, ( \, N-12 + \, ) - 2s2(N) - e2(N) + ( (N-1) , 2) + 6 + c, where , given by: = 1 + \, (N-1) - \, (N-1) - 2 \, (N-1) - \, (N-1) , is a function of N with the minimum value 0 and and the supremum value δ = 1 - e + e ≈ 0.0860713320559342, s2(N) is the sum of all digits of the binary representation of N, e2(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 ≤ 2 N - 4, and c = 0, otherwise. An algorithm that generates worst-case input arrays of any size N ≥ 2 for Heapsort is offered. The algorithm has been implemented in Java, runs in O( N N ) time, and allows for precise experimental verification of the above formula.

0

Turn this paper into a lesson

ArcXiv compiles a structured reading guide from this paper's metadata: plain-English importance, contributions, prerequisite concepts, which sections to read first, flashcards, and a quiz. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…