首页    期刊浏览 2024年12月01日 星期日
登录注册

文章基本信息

  • 标题:An almost optimal algorithm for Winkler's sorting pairs in bins
  • 作者:Hiro ITO ; Junichi TERUYAMA ; Yuichi YOSHIDA
  • 期刊名称:Progress in Informatics
  • 印刷版ISSN:1349-8614
  • 电子版ISSN:1349-8606
  • 出版年度:2012
  • 期号:9
  • 页码:3-7
  • DOI:10.2201/NiiPi.2012.9.2
  • 出版社:National Institute of Informatics
  • 摘要:We investigate the following sorting problem: We are given n bins with two balls in each bin. Balls in the ith bin are numbered n+1-i. We can swap two balls from adjacent bins. How many number of swaps are needed in order to sort balls, i.e., move every ball to the bin with the same number. For this problem the best known solution requires almost 4/5n2 swaps. In this paper, we show an algorithm which solves this problem using less than 2n2/3 swaps. Since it is known that the lower bound of the number of swaps is ⌈(2n 2)/3⌉=⌈2n2/3-n/3⌉, our result is almost tight. Furthermore, we show that for n=2m+1(m ≥ 0) the algorithm is optimal.
  • 关键词:Bubble sort; mathematical puzzle; recursion; sorting; swap
Loading...
联系我们|关于我们|网站声明
国家哲学社会科学文献中心版权所有