【24h】

A generalized algorithm for solving n coins problem

机译:一种解决n个硬币问题的通用算法

获取原文

摘要

Eight coins problem is a well-known problem in mathematics as well as in computer science. In this problem eight coins are given, say A, B, C, D, E, F, G, and H, and we are told that only one is counterfeit (or false), as it has a different weight than each of the others. We want to determine which coin it is, making use of an equal arm balance. At the same time we want to identify the counterfeit coin using a minimum number of comparisons and determine whether the false coin is heavier or lighter than each of the remaining. In this paper, we develop algorithms for solving the counterfeit coin problem for any given number n of coins. The first algorithm is in essence based on the existing classical solution for the eight coins problem (with slight modification) for larger values of n, where n is a power of two beyond eight, as two and four being base cases. Then we develop an algorithm for solving n coins problem, where n is even but not power of two, i.e., the numbers are six, ten, 12, 14, 18, 20, etc. At the end, we have extended the same to solve the counterfeit coin problem for odd number of coins as well.
机译:八硬币问题在数学和计算机科学中都是众所周知的问题。在此问题中,给出了八种硬币,分别是A,B,C,D,E,F,G和H,我们被告知只有一种是假的(或假的),因为它的权重与每种硬币的权重不同。其他。我们想利用相等的手臂平衡来确定它是哪枚硬币。同时,我们希望使用最少的比较次数来识别伪造的硬币,并确定伪造的硬币比其余的重还是轻。在本文中,我们开发了用于解决任何给定数量的n个硬币的伪造硬币问题的算法。第一种算法本质上是基于针对较大的n值的八枚硬币问题(稍作修改)的现有经典解决方案,其中n是八以外的二的幂,因为二和四是基本情况。然后,我们开发了一种解决n个硬币问题的算法,其中n是偶数但不是2的幂,即数字是6、10、12、14、18、20等。最后,我们将其扩展为同时解决奇数硬币的伪造硬币问题。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号