算法设计与分析基础(Algorithm design and analysis foundation).docVIP

  • 8
  • 0
  • 约1.47万字
  • 约 14页
  • 2017-10-07 发布于河南
  • 举报

算法设计与分析基础(Algorithm design and analysis foundation).doc

算法设计与分析基础(Algorithm design and analysis foundation)

算法设计与分析基础(Algorithm design and analysis foundation) This article is contributed by xiaobailu2010 Algorithm design and analysis foundation 第一章 1,证明等式 gcd(m,n)=gcd(n,m mod n)对每一对正整数 m,n 都成立. Hint: 根据除法的定义不难证明: 如果 d 整除 u 和 v, 那么 d 一定能整除 u±v; 如果 d 整除 u,那么 d 也能够整除 u 的任何整数倍 ku. 对于任意一对正整数 m,n,若 d 能整除 m 和 n,那么 d 一定能整除 n 和 r=m mod n=m-qn; 显然,若 d 能整除 n 和 r,也一定能整除 m=r+qn 和 n. 数对(m,n)和(n,r)具有相同的公约数的有限非空集,其中也包括了最大公约数.故 gcd(m,n)=gcd(n,r) 2, 考虑这样一个排序算法,该算法对于待排序的数组中的每一个元素,计算比它小的元素 个数,然后利用这个信息,将各个元素放到有序数组的相应位置上去. A. applies this algorithm to sort the list 60,35,81,98,14,47. B. is the algorithm stable? C. is th

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档