1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
2.105算法

2.4 Integers and Algorithms INTRODUCTION As mentioned in Section 2.1 , the term algorithm originally referred to procedures for performing arithmetic operations using the decimal representations of integers . These algorithms,adapted for use with binary representations , are the basis for computer arithmetic . The provide good illustrations of the concept of the algorithm and the complexity of algorithms . For these reasons,they will be discussed in this section. These are many important algorithms involving integers besides those used in arithmetic . We will begin our discussion lf integers and algorithms with the Euclidean algorithm . It is one lf the most useful algorithms , and perhaps the oldest algorithm in mathematics .We will also describe an algorithm for finding the base b expansion of a positive integer for any base b. REPRESENTATIONS OF INTEGERS In everyday life we use decimal notation to express integers . For example,965 is used to denote 9·102 +6 ·10+5. However , it is often convenient to use bases other than 10 . In particular ,computers usually use binary notation (with 2 as the base) When carrying out arithmetic, and octal (base 8)or hexadecimal (base 16) notation when expressing characters , such as letters or digits.In fact,we can use any positive integer greater than 1 as the base when expressing integers .This is stated in the following theorem. Theorem 1 Let b be a positive integer greater than 1 . Then if n is a positive integer , it can be expressed uniquely in the form n=akbk+ ak-1bk-1 + · · ·+ a1b +a0, where k is a nonnegative integer, a0, a1,…,ak are nonnegative integers less than b,and ak≠0. Example 2 What is the decimal expansion of the integer that has (101011111)2 as its binary expansion? Solution: We have (101011111)2 =28+26+24+23+22+2+1=351. Sixteen is another base used in computer science.The base 16 expansion of an integer is called its hexadecimal expansion.Sixteen different digits are require

文档评论(0)

asd522513656 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档