A Note on Average-Case Sorting
A Note on Average-Case Sorting
复制标题
关于平均情况排序的注意事项
作者:
S. Moran;A. Yehudayoff
This note studies the average-case comparison-complexity of sorting n elements when there is a known distribution on inputs and the goal is to minimize the expected number of comparisons. We generalize Fredman’s algorithm which is a variant of insertion sort and provide a basically tight upper bound: If μ is a distribution on permutations on n elements, then one may sort inputs from μ with expected number of comparisons that is at most H(μ) + 2n, where H is the entropy function. The algorithm uses less comparisons for more probable inputs: For every permutation π, the algorithm sorts π by using at most log2(1Prμ(π))+2ndocumentclass[12pt]{minimal} usepackage{amsmath} usepackage{wasysym} usepackage{amsfonts} usepackage{amssymb} usepackage{amsbsy} usepackage{mathrsfs} usepackage{upgreek} setlength{oddsidemargin}{-69pt} egin{document}$log _{2}(frac {1}{Pr _{mu }(pi )})+2n$end{document} comparisons. A lower bound on the expected number of comparisons of H(μ) always holds, and a linear dependence on n is also required.