文库网
ImageVerifierCode 换一换
首页 文库网 > 资源分类 > DOC文档下载
分享到微信 分享到微博 分享到QQ空间

计算概论:计算机文化、程序设计.doc

  • 资源ID:21763755       资源大小:5.72MB        全文页数:207页
  • 资源格式: DOC        下载积分:20文币
微信登录下载
快捷下载 游客一键下载
账号登录下载
三方登录下载: QQ登录 微博登录
二维码
扫码关注公众号登录
下载资源需要20文币
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
如填写123,账号就是123,密码也是123。
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 
账号:
密码:
验证码:   换一换
  忘记密码?
    
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

计算概论:计算机文化、程序设计.doc

1、计 算 概 论 计算机文化、程序设计Introduction to Computing: Computer Culture, and Programming闫宏飞 陈翀 编著by Hongfei Yan and Chong Chen2010/9/23内 容 简 介本书主要是汇编各书和参考资料而成,比较系统地介绍了计算机文化,和程序设计。通过这两部分有机的结合(前者占1/3,后者占2/3),即理论与实践结合,使学生理解和掌握有关计算机和信息技术的基本概念和基本原理,对计算机学科有全局性的认识;学会使用计算机进行信息处理,熟练掌握C+语言编程技术,为后续相关课程的学习打好基础。本书层次分明,由浅入

2、深,具有学习和实用双重意义。本书可作为高等院校各专业一、二年级学生的教学参考书和技术资料,对广大从事计算机相关研究和应用开发的科技人员也有很大的参考价值。v前 言计算概论是普通高校面向理工科低年级学生开设的计算机基础教育课。课程前1/3部分为计算机文化,后2/3部分为程序设计。任教此课两年来,发现没有合适的教材,因此根据授课经验,汇编各书和参考资料,编成此书。编者2009年1月于北大燕园目 录前言第1章 引论11.1 计算机科学21.2 摩尔定律31.3 Scope of Problems5上篇 计算机文化8第2章 计算机系统92.1 Computer Introduction92.1.1 T

3、URING MODEL102.1.2 VON NEUMANN MODEL152.1.3 Computer components172.1.4 History182.1.5 Practice set212.2 计算机系统漫游222.1.1 Information is Bits + Context242.1.2 Programs Are Translated by Other Programs into Different Forms262.1.3 It Pays to Understand How Compilation SystemsWork282.1.4 Processors Read a

4、nd Interpret Instructions Stored in Memory302.1.5 Caches Matter362.1.6 Storage Devices Form a Hierarchy372.1.7 The Operating System Manages the Hardware382.1.8 Systems Communicate With Other Systems Using Networks452.1.9 The Next Step472.1.10 Summary47第3章 数据和数的表示503.1 数据的表示503.2 数的表示54第4章 程序设计语言和开发环

5、境584.1 程序设计语言584.2 开发环境68下篇 程序设计74第5章 C+基础755.1 Getting Started755.2 Fundamental Types795.3 Arithmetic Operator815.4 Control Structures83第6章 数组和结构946.1 数组946.1.1 Initializing arrays956.1.2 Accessing the values of an array966.1.3 Multidimensional arrays976.2 结构1056.2.1 Data structures1056.2.2 Pointer

6、s to structures1096.2.3 Nesting structures112Quiz : Structures113第7章 C+标准库1147.1 C Language library1157.2 Input/Output Stream library1167.3 String library1177.4 STL: Standard Template Library117第8章 函数和递归1208.1 Functions with no type. The use of void.1258.2 Arguments passed by value and by reference.

7、1278.3 Default values in parameters1298.4 Overloaded functions1308.5 inline functions1328.6 Recursivity1328.7 Declaring functions136第9章 指针和引用1399.1 Pointers1399.1.1 Reference operator (&)1399.1.2 Dereference operator (*)1419.1.3 Declaring variables of pointer types1429.1.4 Pointers and arrays1459.1.

8、5 Pointer initialization1479.1.6 Pointer arithmetics1489.1.7 Pointers to pointers1509.1.8 void pointers1519.1.9 Null pointer1529.1.10 Pointers to functions1539.2 Dynamic Momory1549.2.1 Operators new and new1549.2.2 Operators delete and delete1569.2.3 Dynamic memory in ANSI-C158第10章 VARIABLES: A DEEP

9、ER LOOK15910.1 Memory organization15910.2 Variable scope16110.3 Understanding pointers162第11章 算法16511.1 The Role of Algorithms in Computing16611.1.1 Algorithms16611.1.2 Algorithms as a technology17111.2 算法的概念17411.3 算法的三种基本结构17411.4 算法的表示17511.5 介绍几种基本算法17511.6 迭代与递归175第12章 程序设计17612.1 简单计算题17612.2

10、模拟17612.3 可模型化的问题17712.4 动态规划177Introduction (Beginner)178Elementary181Intermediate182Upper-Intermediate184Advanced185参考文献189第1章 引论第1章 引论计算机文化这个词的出现到被广泛认可的时间并无确切的考证,但基本上是在20世纪80年代后期。计算机开始是一种装置,进而到一门学科,再发展成 为一种“文化”,它对人类的影响力之大的确令人惊叹。计算机文化是指能够理解计算机是什么,以及它如何被作为资源使用的。简单地说,计算机文化不但是知道如何使用计算机,更重要的是知道什么时候使用计

11、算机。在当今世界,几乎所有专业都与计算机息息相关。但是,只有某些特定职业和学科才会深入研究计算机本身的制造、编程和使用技术。用来诠释计算机学科内不同研究领域的各个学术名词的涵义不断发生变化,同时新学科也层出不穷。五个主要的计算机学科(disipline of computing)包括 Computing Curricula 2005: The Overview Report, http:/www.acm.org/education/curric_vols/CC2005-March06Final.pdf : 计算机工程学(Computer Engineering),是电子工程的一个分支,主要研究

12、计算机软硬件和二者间的彼此联系。 计算机科学(Computer Science),是对计算机进行学术研究的传统称谓。主要研究计算技术和执行特定任务的高效算法。该门学科为我们解决确定一个问题在计算机领域内是否可解,如可解其效率如何,以及如何作成更加高效率的程序。时至今日,在计算机科学内已经派生了许多分支,每一个分支都针对不同类别的问题进行深入研究。 软件工程学(Software Engineering),着重于研究开发高质量软件系统的方法学和实践方式,并试图压缩并预测开发成本及开发周期。 信息系统(Information Systems),研究计算机在一个广泛的有组织环境(商业为主)中的计算机应

13、用。 信息技术(Information Technology),指计算机相关的管理和维护。计算概论课程关注的是计算机学科。较大规模的致力于计算机科学的组织有:美国计算机协会(Association of Computing Machinery, 简称ACM);美国电气电子工程师协会(Institute of Electrical and Electronics Engineers,简称为IEEE)。1.1 计算机科学计算机科学是一门包含各种各样与计算和信息处理相关主题的系统学科,从抽象的算法分析、形式化语法等等,到更具体的主题如编程语言、程序设计、软件和硬件等。作为一门学科,它与数学、计算机程

14、序设计、软件工程和计算机工程有显著的不同,却通常被混淆,尽管这些学科之间存在不同程度的交叉和覆盖。 http:/zh.wikipedia.org/wiki/计算机科学 计算机科学研究的课题是: 计算机程序能做什么和不能做什么(可计算性); 如何使程序更高效的执行特定任务(算法和复杂性理论); 程序如何存取不同类型的数据(数据结构和数据库); 程序如何显得更具有智能(人工智能); 人类如何与程序沟通(人机互动和人机界面)。 计算机科学的大部分研究是基于“冯诺依曼计算机”和“图灵机”的,它们是绝大多数实际机器的计算模型。作为此模型的开山鼻祖,邱奇-图灵论题(Church-Turing Thesis

15、)表明,尽管在计算的时间,空间效率上可能有所差异,现有的各种计算设备在计算的能力上是等同的。尽管这个理论通常被认为是计算机科学的基础,可是科学家也研究其它种类的机器,如在实际层面上的并行计算机和在理论层面上概率计算机、oracle 计算机和量子计算机。在这个意义上来讲,计算机只是一种计算的工具:著名的计算机科学家 Dijkstra 有一句名言“计算机科学之关注于计算机并不甚于天文学之关注于望远镜。”。计算机科学根植于电子工程、数学和语言学,是科学、工程和艺术的结晶。它在20世纪最后的三十年间兴起成为一门独立的学科,并发展出自己的方法与术语。早期,虽然英国的剑桥大学和其他大学已经开始教授计算机科

16、学课程,但它只被视为数学或工程学的一个分支,并非独立的学科。剑桥大学声称有世界上第一个传授计算的资格。世界上第一个计算机科学系是由美国的普渡大学在1962年设立,第一个计算机学院于1980年由美国的东北大学设立。现在,多数大学都把计算机科学系列为独立的部门,一部分将它与工程系、应用数学系或其他学科联合。计算机科学领域的最高荣誉是ACM设立的图灵奖,被誉为是计算机科学的诺贝尔奖。它的获得者都是本领域最为出色的科学家和先驱。华人中首获图灵奖的是姚期智博士。他于2000年以其对计算理论做出的诸多“根本性的、意义重大的”贡献而获得这一崇高荣誉。1.2 摩尔定律http:/en.wikipedia.or

17、g/wiki/Moore%27s_Law Moores law describes a long-term trend in the history of computing hardware. Since the invention of the integrated circuit in 1958, the number of transistors that can be placed inexpensively on an integrated circuit has increased exponentially, doubling approximately every two y

18、ears.The trend was first observed by Intel co-founder Gordon E. Moore in a 1965 paper.It has continued for almost half of a century and is not expected to stop for another decade at least and perhaps much longer.图1-1 CPU Transistor Counts 1971-2008 & Moores Law, Growth of transistor counts for Intel

19、 processors (dots) and Moores Law (logarithmic vertical scale)Almost every measure of the capabilities of digital electronic devices is linked to Moores law: processing speed, memory capacity, even the number and size of pixels in digital cameras.All of these are improving at (roughly) exponential r

20、ates as well.This has dramatically increased the usefulness of digital electronics in nearly every segment of the world economy. Moores law describes this driving force of technological and social change in the late 20th and early 21st centuries. 计算机第一定律摩尔定律Moore定律。归纳起来,主要有以下三种“版本”: 集成电路芯片上所集成的电路的数目

21、,每隔18个月就翻一番。 微处理器的性能每隔18个月提高一倍,而价格下降一倍。 用一个美元所能买到的电脑性能,每隔18个月翻两番。a 图1-2 Computer SpeedupMoores Law: “The density of transistors on a chip doubles every 18 months, for the same cost” (1965)半导体集成电路的密度或容量每18个月翻一番 Moores Law is still valid. His law has nothing to do with the speed of the proccesor. It h

22、as to do with the number of transitotrs which is still doubleing every couple of years. Case in point there is now multiple cores in the same space instead of one core.戈登摩尔(Gordon Moore),CPU生产商Intel公司的创始人之一。1965年提出“摩尔定律”, 1968年创办Intel公司。摩尔1929年出生在美国加州的旧金山。曾获得加州大学伯克利分校的化学学士学位,并且在加州理工大学(CIT)获得物理和化学两个博

23、士学位。50年代中期他和集成电路的发明者罗伯特诺伊斯(Robert Noyce)一起,在威廉肖克利半导体公司工作。后来,诺伊斯和摩尔等8人集体辞职创办了半导体工业史上有名的仙童半导体公司(Fairchild Semiconductor)。仙童成为现在的Intel和AMD之父。 1968年,摩尔和诺伊斯一起退出仙童公司,创办了Intel。Intel初期致力于开发当时计算机工业尚未开发的数据存储领域,后来,Intel进行战略转移,专攻微型计算机的“心脏”部件-CPU。1.3 Scope of ProblemsWhat can you do with 1 computer?What can you

24、do with 100 computers?What can you do with an entire data center?http:/en.wikipedia.org/wiki/Distributed_computing#Projects Projects:A variety of distributed computing projects have grown up in recent years. Many are run on a volunteer basis, and involve users donating their unused computational pow

25、er to work on interesting computational problems. Examples of such projects include the Stanford University Chemistry Department Foldinghome project, which is focused on simulations of protein folding to find disease cures and to understand biophysical systems; World Community Grid, an effort to cre

26、ate the worlds largest public computing grid to tackle scientific research projects that benefit humanity, run and funded by IBM; SETIhome, which is focused on analyzing radio-telescope data to find evidence of intelligent signals from space, hosted by the Space Sciences Laboratory at the University

27、 of California, Berkeley (the Berkeley Open Infrastructure for Network Computing (BOINC), was originally developed to support this project); LHChome, which is used to help design and tune the Large Hadron Collider, hosted by CERN in Geneva; and , which is focused on finding optimal Golomb rulers and

28、 breaking various cryptographic ciphers.http:/folding.stanford.edu/English/Main http:/zh.wikipedia.org/wiki/Foldinghome http:/www.stanford.edu/group/pandegroup/images/FAH-May2008.png Foldinghome是如何工作的呢?Foldinghome是一个研究研究蛋白质折叠,误折,聚合及由此引起的相关疾病的分布式计算工程。使用联网式的计算方式和大量的分布式计算能力来模拟蛋白质折叠的过程,并指引我们近期对由折叠引起的疾病的

29、一系列研究。图1-3 Foldinghome图1-4 Shrek Dreamworks Animation, rendering multiple frames of high-quality animationHappy Feet Kingdom Feature Productions; Lord of the Rings New Line Cinema 图1-5 Simulating several hundred or thousand charactersIndexing the web (Google)Google()是一个搜索引擎,由两个斯坦福大学博士生Larry Page与Ser

30、gey Brin于1998年9月发明,Google Inc. 于1999年创立。Google网页搜索技术是来源于信息检索技术。Google的“网页快照”功能,能从Google服务器里直接取出缓存的网页。Simulating an Internet-sized network for networking experiments (PlanetLab)http:/www.planet-lab.org/ PlanetLab is a global research network that supports the development of new network services. Sinc

31、e the beginning of 2003, more than 1,000 researchers at top academic institutions and industrial research labs have used PlanetLab to develop new technologies for distributed storage, network mapping, peer-to-peer systems, distributed hash tables, and query processing. PlanetLab currently consists o

32、f 1128 nodes at 511 sites. Speeding up content delivery (Akamai)美国Akamai是国际上最大的CDN服务商,它巨大的网络分发能力在峰值时可达到15Gbps。Akamai公司是为数不多的旨在消除Internet 瓶颈和提高下载速度的几家新公司之一,是一个致力于网络交通提速的“内容发布”公司,是波士顿高技术区最卓越的新兴企业之一。Akamai公司向全球企业 提供发送互联网内容,汇流媒体和应用程序的服务(目前,该公司为15个国家的企业管理着8000多台服务器)。1998年,丹尼尔.L和麻省理工学院的一 些研究人员一起创立了这家公司,他在

33、麻省理工学院的硕士论文构成了Akamai公司最初的“自由流”(Freeflow)技术的核心。 69 上篇 计算机文化上篇的主要目的是向读者介绍有关计算机和信息技术的基本概念和基本原理,使读者能够对计算机学科有全局性的认识。第2章 计算机系统第2章 计算机系统2.1 Computer Introduction本节大部分内容取自下面这本书的第一章。等号线之间内容是我加的。Foundations of Computer Science,2e,by Behrouz Forouzan and Firouz Mosharraf, Cengage Learning Business Press, Decem

34、ber 5, 2007http:/www.cengage.co.uk/forouzan/ The phrase computer science has a very broad meaning today. However, in this book, we define the phrase as issues related to the computer. This introductory chapter first tries to find out what a computer is, then investigates other issues directly relate

35、d to computers. We look first at the Turing model as a mathematical and philosophical definition of computation. We then show how todays computers are based on the von Neumann model. The chapter ends with a brief history of this culture-changing device.the computer.ObjectivesAfter studying this chap

36、ter, the students should be able to: Define the Turing model of a computer. Define the von Neumann model of a computer. Describe the three components of a computer: hardware, data, and software. List topics related to computer hardware. List topics related to data. List topics related to software. D

37、iscuss some social and ethical issues related to the use of computers. Give a short history of computers.2.1.1 TURING MODELThe idea of a universal computational device was first described by Alan Turing in 1937. He proposed that all computation could be performed by a special kind of machine, now ca

38、lled a Turing machine. Although Turing presented a mathematical description of such a machine, he was more interested in the philosophical definiton of computation than in building the actual machine. He based the model on the actions that people perform when involved in computation. He abstracted t

39、hese actions into a model for a computational machine that has really changed the world.Perceptual knowledge (感性认识)计算机组成部分 Introduction to Computer Hardware Install if your computer can not show videos.图2-1 Mother board (主板:集成多个部件、适配器,提供它们之间的互联)主板(Main Board)又名主机板、系统板、母板,是PC机的核心部件。PC机的主板包括CPU、芯片组(Ch

40、ipset)、高速缓存(Cache)、ROM_BIOS芯片、CMOS芯片、内存RAM、总线通道、软硬磁盘接口、串行和并行接口、USB接口、扩展槽(Slots)、直流电源插座、可充电电池以及各种条线。图中从上到下,左到右:内存条,磁盘、光驱等的数据线接口;CPU风扇(一般下面是散热器,和CPU);棕色AGP槽:只能接显卡;白色PCI槽:能接显卡、网卡、声卡等。图2-2 CPU = 运算器+控制器图2-3 Alan Turing, founder of computer science, and artificial intelligence 图灵是举世罕见的天才数学家和计算机科学家,仅仅在世42

41、年。他的英年早逝,像他横溢的才华一样,令世界吃惊与难以置信。生命虽然短暂,但那传奇的人生,丰富多彩的创造力和智慧而深邃的思想,使他犹如一颗耀眼的明星,持续地照耀着人间后世在科学的浩瀚太空里探索未来的人们。 自上个世纪60年代以来,计算机技术飞速发展,信息产业逐渐成为影响人类社会的最重要的工业之一。支持技术与工业发展的理论基础是计算机科学。众所周知,“诺贝尔奖”是世界上最负盛名的奖项,但仅用于奖励那些在物理、化学、文学、医学、经济学与促进世界和平等方面做出开拓性重大贡献的人士。“图灵奖”则是计算机科学领域的最高奖项,有“计算机界诺贝尔奖”之称。设立这个大奖,既是为了促进计算机科学的进一步发展,也

42、是为了纪念一位天才数学家、计算机科学的奠基人艾兰图灵。http:/zh.wikipedia.org/wiki/图灵 图灵被视为计算机科学之父。1931年进入剑桥大学国王学院,毕业后到美国普林斯顿大学攻读博士学位,二战爆发后回到剑桥,后曾协助军方破解德国的著名密码系统Enigma,帮助盟军取得了二战的胜利。图灵对于人工智能的发展有诸多贡献,例如图灵曾写过一篇名为机器会思考吗?(Can Machine Think?)的论文,其中提出了一种用于判定机器是否具有智能的试验方法,即图灵试验。至今,每年都有试验的比赛。此外,图灵提出的著名的图灵机模型为现代计算机的逻辑工作方式奠定了基础。A short v

43、ideo describing the life and unfortunate death of Alan Turing.http:/zh.wikipedia.org/wiki/姚期智姚期智,美籍华人,计算机科学家,2000年图灵奖得主,是目前唯一一位获得此奖项的华人及亚洲人。目前是清华大学理论计算机科学研究中心教授。 因为对计算理论,包括伪随机数生成,密码学与通信复杂度的诸多贡献,美国计算机协会(ACM)决定把该年度的图灵奖授予他。 Data processorsFigure 1.1 A signle purpose computing machineBefore discussing t

44、he Turing model, let us define a computer as a data processor. Using this definition, a computer acts a black box that accepts input data, processes the data, and created output data (Figure 1.1). Although this model can define the functionality of a computer today, it is too general. In this model,

45、 a pocket calculator is also a computer (which it is, in a literal sense).Another problem with this model is that it does not specify the type of processing, or whether more than one type of processing is possible. In other words, it is not clear how many types or sets of operations a machine based on this model can perform. Is it a specific-purpose machine or a general-purpose machine?This model could represent a specific-purpose


注意事项

本文(计算概论:计算机文化、程序设计.doc)为本站会员(公务员考试助手)主动上传,文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知文库网(点击联系客服),我们立即给予删除!




关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

文库网用户QQ群:731843829  微博官方号:文库网官方   知乎号:文库网

Copyright© 2025 文库网 wenkunet.com 网站版权所有世界地图

经营许可证编号:粤ICP备2021046453号   营业执照商标

1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png