当前位置:文档之家› 李春葆《数据结构教程》(第4版)课后习题-串(圣才出品)

李春葆《数据结构教程》(第4版)课后习题-串(圣才出品)

李春葆《数据结构教程》(第4版)课后习题-串(圣才出品)
李春葆《数据结构教程》(第4版)课后习题-串(圣才出品)

第4章串

1.采用顺序结构存储串,编写一个实现串通配符匹配的算法pattern______index(),其中的通配符只有“?”,它可以和任一字符匹配成功,例如,pattern______index(″? re″,″there are″)返回的结果是2。

答:本题的基础是Brute—Force模式匹配算法,只是增加了“?”的处理功能。对应的算法如下:

2.有两个串s1和s2,设计一个算法求这样一个串,该串中的字符是s1和s2中的公共字符。

答:扫描s1,对于当前字符s1.data[i],若在s2中,则将其加入到串s3中。最后返回s3串。对应的算法如下:

3.设目标为t=’abcaabbabcabaacbacba’,模式p=’abcabaa’。(1)计算模式P的nextval函数值。

(2)不写算法,只画出利用KMP算法进行模式匹配时的每一趟匹配过程。答:(1)先计算next数组,在此基础上求nextval数组,如表4-1所示。

表4-1 计算next数组和nextval数组

(2)采用KMP算法求子串位置的过程如下(开始时i=0,j=0):

第1趟匹配:

此时i=4,j=4,匹配失败,而nextval[4]=0,则i=4,j=nextval[4]=0,即:

第2趟匹配:

此时i=6,j=2,匹配失败,而nextval[2]=0,则i=6,j=nextval[2]=0,即:

第3趟匹配:

此时i=6,j=0,匹配失败,而nextval[0]=-1,则i=6,j=nextval[0]=-1。因j=-1,执行i=i+1=7,j=j+1=0,即:

第4趟匹配:

此时i=14,j=7,匹配成功,返回v=i-t.1ength=14-7=7。

上机实验题4

实验题1编写一个程序algo4-1.cpp,实现顺序串的各种基本运算,并在此基础上设计一个程序exp4-1.cpp完成如下功能:

(1)建立串s=″abcdefghefghijklmn″和串sl=″xyz″;

(2)输出串s;

(3)输出串s的长度;

(4)在串s的第9个字符位置插入串s1而产生串s2;

(5)输出串s2;

(6)删除串s第2个字符开始的5个字符而产生串s2;

(7)输出串s2;

(8)将串s第2个字符开始的5个字符替换成串s1而产生串s2;

(9)输出串s2;

(10)提取串s的第2个字符开始的10个字符而产生串s3;

(11)输出串s3;

(12)将串s1和串s2连接起来而产生串s4;

(13)输出串s4。

实验题2编写一个程序algo4-2.cpp,实现链串的各种基本运算,并在此基础上设计一个程序exp4-2.cpp,完成如下功能:

(1)建立串s=″abcdefghefghijklmn″和串sl=″xyz″;

(2)输出串s;

(3)输出串s的长度;

(4)在串s的第9个字符位置插入串s1而产生串s2;

(5)输出串s2;

(6)删除串s第2个字符开始的5个字符而产生串s2;

(7)输出串s2;

(8)将串s第2个字符开始的5个字符替换成串s1而产生串s2;

(9)输出串s2;

(10)提取串s的第2个字符开始的10个字符而产生串s3;

(11)输出串s3;

(12)将串s1和串s2连接起来而产生串s4;

(13)输出串s4。

实验题3 编写一个程序exp4-3.cpp,实现顺序串的各种模式匹配运算,并在此基础上完成如下功能:

(1)建立目标串S="abcabcdabcdeabcdefabcdefg"和模式串t="abcdeabcdefab";

(2)采用简单匹配算法求t在s中的位置;

(3)对模式串t求next数组值和nextval数组值;

(4)采用KMP算法求t在s中的位置;

(5)采用修正后的KMP算法求t在s中的位置。

实验题4 一个文本串可用事先给定的字母映射表进行加密。例如,设字母映射表为:

则字符串“encrypt”被加密为“tkzwsdf”。设计一个程序exp4-4.cpp将输入的文本串进行加密后输出,然后进行解密并输出。

实验题5 采用顺序结构存储串,编写一个程序exp4-5.cpp,求用户输入串s中出现的第一个最长重复子串的下标和长度。

大学英语精读第四册课后答案

大学英语精读第三版第四册答案 Unit1 翻译 1) 我们接到通知,财政部长将于次日接见我们。 We were informed that the Minister of Finance was to give us an audience /receive us the next day. 2) 我觉得很奇怪,他似乎不记得自己的生日。 I thought it odd that he didn't seem to remember his own birthday. 3) 学期论文最迟应在下星期二交来,可是至今大部分学生却几无进展。 Next Tuesday is the deadline for handing in the term papers, but most students have hardly made a dent in the work so far. 4) 看到学生人数不断减少,校长心里很难受。(pain) It pained the headmaster to find the number of students shrinking. 5) 在那个国家一般用现金付账,但支票变得普遍起来了,不久会代替现金作为人们结账的一种方式。 Cash is commonly used in paying bills in that country, but checks are becoming more popular and will, in a short while, replace cash as a way for people to settle their accounts. 6) 该公司声称,这条河流的污染不是它造成的。 The company claims that it is not responsible for the pollution in the river. Unit2 翻译 1) 比尔已是个成熟的小伙子,不再依赖父母替他做主。 Bill is a mature young man who is no longer dependent on his parents for decisions. 2) 这个地区有大量肉类供应,但新鲜果蔬奇缺。 There are abundant supplies of meat in this region, but fresh fruit and vegetables are scarce. 3) 工程师们依靠工人们的智慧发明了一种新的生产方法,使生产率得以提高。 Drawing on the wisdom of the workers, the engineers invented a new production method that led to increased productivity. 4) 他花了许多时间准备数学考试,因此当他获知自己只得了个B时感到有点失望。 He spent a lot of time preparing for his math exam. Hence he was somewhat disappointed to learn that he got only a B. 5) 我们有充裕的时间从从容容吃顿午饭。 We have ample time for a leisurely lunch.

数据结构教程李春葆第4版知识点习题答案

第1章绪论 知识点归纳 一、数据结构概述 1.数据结构的定义 (1)基本概念 数据是描述客观事物的数和字符的集合,是计算机能操作的对象的总称,也是计算机处理信息的某种特定的符号表示形式。 (2)相关术语 ① 数据元素 数据元素又称元素、节点、顶点、记录等。数据元素是数据的基本单位。有时候,一个数据元素可以由若干个数据项组成。 ② 数据项 数据项又称字段或域,它是具有独立含义的最小数据单位。 ③ 数据对象 数据对象是性质相同的数据元素的集合,它是数据的子集。 (3)数据结构的内容 ① 数据元素之间的逻辑关系,即数据的逻辑结构,它是数据结构在用户面前呈现的形式。 ② 数据元素及其关系在计算机存储器中的存储方式,即数据的存储结构,又称数据的物理结构。 ③ 施加在数据上的操作,即数据的运算。 (4)逻辑结构 数据的逻辑结构是从逻辑关系(主要是指数据元素的相邻关系)上描述数据的,它与数据的存储无关,是独立于计算机的。因此,数据的逻辑结构可以看作是从具体问题抽象出来的数学模型。 (5)存储结构 数据的存储结构是逻辑结构用计算机语言的实现或在计算机中的表示(又称映像),也就是逻辑结构在计算机中的存储方式,它是依赖于计算机语言的。一般只在高级语言(例如C/C++语言)的层次上讨论存储结构。 数据的运算最终需在对应的存储结构上用算法实现。 总之,数据结构是一门讨论“描述现实世界实体的数学模型(通常为非数值计算)及其之上的运算在计算机中如何表示和实现”的学科。 (6)数据结构的表示 对于一种数据结构,其逻辑结构总是惟一的,但它可能对应多种存储结构,并且在不同的存储结构中,同一运算的实现过程可能不同。 描述数据结构通常采用二元组表示:

【专业英语课后题答案】 徐鹿专业英语答案

【专业英语课后题答案】徐鹿专业英语答案 Unit 1 The Fundamentals of Computers 1.1 The Varieties of Computers ? III. Translating. – 1. Original : Primary storage, or memory, is the internal computer circuitry that temporarily holds data waiting to be processed. Secondary storage, simply called storage, refers to the devices and media that store data or information permanently. – Translation : 一级存储,或称内存,是临时保存等待被处理数据的计算机内 部电路。而二级存储,简称存储器,是指那些永久性存储数据或信息的设备 和介质。 – 2. Original : A biological nanocomputer, which would be made of DNA and could fit into a single human cell, would use DNA as its software and enzymes as its hardware; its molecular-sized circuits would be viewable only through a microscope. – Translation : 由DNA 制成并能放置在一个单独的人体细胞中的生物学纳米 计算机会利用DNA 作为它的软件,酶作为它的硬件;其具有分子大小尺寸 的电路将只有通过显微镜才能够看见。 1.2 The History of Computers ? III. Translating. – 1. Original : This introduction pought about the first real signs of competition within computing history, which helped to spur faster and better development of computers. – Translation : 这一引入带来了计算历史中可谓第一个真正的竞争标志,有助 于刺激计算机更快 –更好的发展。 – 2. Original : While expensive, these machines started the trend for computers within common households. – Translation : 虽然昂贵,但是这些机器开启了计算机在普通家庭中使用的趋 势。 Unit 2 Computer Hardware 1.1 Computer Motherboard ? III. Translating. – 1. Original : A 2003 study found that some spurious computer crashes and general reliability issues, ranging from screen image distortions to I/O read/write errors, can be attributed not to software or peripheral hardware but to aging capacitors on PC motherboards. – Translation : 2003年的一个研究发现,一些伪劣的计算机损毁和常规可靠性 的问题,从屏幕图像失真到输入/输出读写错误,并不是由于软件或外围硬 件引起的,而是由于PC 机主板上老化的电容器造成的。 – 2. Original : At power-up the central processor would load its program counter with the address of the boot ROM and start executing ROM instructions displaying system information on the screen and running memory checks. – Translation :启动之后,中央处理器将加载记录着引导ROM 地址的程序计数

大学英语第二版第四册课后答案(全)

新版新视野大学英语读写教程第四册 Unit 1 III. 1. idle 2. justify 3. discount 4. distinct 5. minute 6.accused 7. object 8. contaminate 9. sustain 10. worship IV. 1. accusing... of 2. end up 3. came upon 4. at her worst 5. pay for 6. run a risk of 7. participate in 8. other than 9. object to/objected 10. at best V 1. K 2. G 3. C 4. E 5. N 6.O 7.I 8. L 9. A 10. D Collocation VI. 1. delay 2. pain 3. hardship 4. suffering 5. fever 6. defeat 7. poverty 8. treatment 9. noise 10. agony Word building VII. 1. justify 2. glorify 3. exemplifies 4. classified 5. purified 6. intensify 7. identify 8. terrified VIII. 1. bravery 2. jewelry 3. delivery 4. machinery 5. robbery 6. nursery 7. scenery 8. discovery Sentence Structure IX. 1. other than for funerals and weddings 2. other than to live an independent life 3. other than that they appealed to his eye . . ` 4. but other than that, he'll eat just about everything . 5. other than that it's somewhere in the town center X. 1. shouldn't have been to the cinema last night 2. would have; told him the answer 3. they needn't have gone at all 4. must have had too much work to do 5. might have been injured seriously Translation XI. - 1. The plant does not grow well in soils other than the one in which it has been developed. 2. Research findings show that we spend about two hours dreaming every night, no matter what we may have done during the day. 3.Some people tend to justify their failure by blaming others for not trying their best. 4.We remain tree to our commitment: Whatever we promised to do; we would do it. 5.Even Beethoven's father discounted the possibility that his son would one day become the greatest musician in the world. The same is true of Edison, who seemed to his teacher to be quite dull. 6. They were accused by authorities of threatening the state security. XII. l.出入除自己家以外的任何场所时,如果你带有宠物,一定要了解有关宠物的规定。 2一些女性完全可以不待在家里,而是去工作,挣一份不错的工资。但是为了家庭,她们放

李春葆《数据结构教程》(第4版)笔记和课后习题详解(第8~10章)【圣才出品】

李春葆《数据结构教程》(第4版)笔记和课后习题详解 第8章图 8.1复习笔记 一、图的基本概念 1.图的定义 图都是由顶点和边构成的。采用形式化的定义,图G由两个集合V和E组成,记为G =(V,E),其中V是顶点的有限集合,记为V(G),E是连接V中两个不同顶点(顶点对)的边的有限集合,记为E(G)。 抽象数据类型图的定义如下: 2.图的基本术语 (1)端点和邻接点 在一个无向图中,若存在一条边(i,j),则称顶点i和顶点j为该边的两个端点,并称它们互为邻接点,即顶点i是顶点j的一个邻接点,顶点j也是顶点i的一个邻接点。

(2)顶点的度、入度和出度 ①度 在无向图中,某顶点所具有的边的数目称为该顶点的度。 ②入度 在有向图中,顶点i的度又分为入度和出度,以顶点i为终点的入边的数目,称为该顶点的入度。 ③出度 以顶点i为起点的出边的数目,称为该顶点的出度。一个顶点的入度与出度的和为该顶点的度。 (3)完全图 若无向图中每两个顶点之间都存在一条边,或有向图中每两个顶点之间都存在着方向相反的两条边,则称此图为完全图。 (4)稠密图和稀疏图 ①稠密图 当一个图接近完全图时,称为稠密图。 ②稀疏图 当一个图含有较少的边数(即当e<<n(n-1))时,则称为稀疏图。 (5)子图 设有两个图G=(V,E)和G′=(V′,E′),若V′是V的子集,即V′≤V,且E′是E的子集,即E′≤E,则称G′是G的子图。 (6)路径和路径长度 ①路径

在一个图G=(V,E)中,从顶点i到顶点j的一条路径是一个顶点序列(i,i1,i2,…,i m),若此图G是无向图,则边(i,i1),(i1,i2),…,(i m-1,i m),(i m,j)属于E(G);若此图是有向图,N,…,属于E(G)。 ②路径长度 路径长度是指一条路径上经过的边的数目。 (7)回路或环 若一条路径上的开始点与结束点为同一个顶点,则称此路径为回路或环。开始点与结束点相同的简单路径称为简单回路或简单环。 (8)连通、连通图和连通分量 ①连通 在无向图G中,若从顶点i到顶点j有路径,则称顶点i和顶点j是连通的。 ②连通图 若图G中任意两个顶点都连通,则称G为连通图,否则称为非连通图。 ③连通分量 无向图G中的极大连通子图称为G的连通分量。 (9)连通、强连通图和强连通分量 ①强连通图 在有向图G中,若从顶点i到顶点j有路径,则称从顶点i到顶点j是连通的。若图G 中的任意两个顶点i和顶点j都连通,即从顶点i到顶点j和从顶点j到顶点i都存在路径,则称图G是强连通图。 ②强连通分量 有向图G中的极大强连通子图称为G的强连通分量。显然,强连通图只有一个强连通

计算机专业英语教程(第四版)习题答案

计算机专业英语教程(第四版)习题答案
计算机专业英语(第四版)课后习题答案 Unit 1 [Ex 1] Fb5E2RGbCAP [Ex 2] 1. input, storage, processing, and output 2. power; speed; 1. F 2. T 3. T 4. F 5. T 6. T 7. T 8. T 9. T 10.
memoryp1EanqFDPw 3. central processing unit memoryDXDiTa9E3d 5. keyboard; [Ex 3] B. A. central processing unit; 1. F 2. D 2. monitor 3. G 4. C 5. B main memory; 6. A 7. E monitorRTCrpUDGiT 8. H5PCzVD7HxA 4. internal; primary;
1. user
3. data
4. keyboard
5. data processingjLBHrnAILg
6. information [Ex 4] instructions
7. computer
8. memory 3. manipulates 4.
1. input device 2. screen, screen 5. retrievexHAQX74J0X 8. Function
6. code 7. hard copy
[Ex. 5] 新处理器开始 IT 技术的新时代 New Processors Open New Era of IT Technologies Last week, Intel introduced to the public in Russia and other CIS countries a family of processors Intel Xeon E5-2600. They are more powerful and reliable and, importantly, are very economical in terms of energy consumption. Their
1 / 30

新概念英语第四册课后练习 答案完整版

新概念英语4答案,新概念英语第四册答案Unit 1 CABDD BDAAC AB Unit 2 BCBDC ACAAD BC Unit 3 CABDA CDABA CD Unit 4 ACCAB BCDAA BD Unit 5 CABAB DACBB DD Unit 6 CACCC AAADB AA Unit 7 DCABA BACDA AC Unit 8 BDABD BAABC BC Unit 9 CDBAA CABAC AD Unit 10 CAABD CBBDC AA Unit 11 AABDD DADDB DD Unit 12 CABAC CDACA AB Unit 13 ACDAC BDABC AD Unit 14 DBDCC ACCBD BD Unit 15 CADCD DBACA CA Unit 16 ABCCA DDBAB AC Unit 17 BBADA BBDCD CA Unit 18 BABCD CDCCC BA Unit 19 BBCAD AABDD BC Unit 20 BCADC CCBDB CA 新概念英语4答案,新概念英语第四册答案Unit 21 BDBBA ADDAB CA Unit 22 CDACB ADBCD AB Unit 23 CADCC DCABC AC

Unit 24 AACCB CADDA CD Unit 25 DBADD CACDB CA Unit 26 CBCBA CDDAB AC Unit 27 BCDCC ACCDD DA Unit 28 ADCDA BCADA BD Unit 29 CCADD CCADA BC Unit 30 CABDD BCCAC DC Unit 31 AABAD BADDC BD Unit 32 BDCBA DBDCA BC Unit 33 BDBAD BCCDC BA Unit 34 DCACB DACDB CA Unit 35 CBCAC ABBDC CD Unit 36 ACBCC ACCDB AC Unit 37 CABAC DBCDC BD Unit 38 CAABB ACBDD AB Unit 39 BCADA BDDBD BC Unit 40 DCDAC ADDDA DB 新概念英语4答案,新概念英语第四册答案Unit 41 ACACD CBBBD BC Unit 42 BCCBD BDADC AC Unit 43 DBABC CDDAC BB Unit 44 AAAAB BBBDC BA Unit 45 CADAC CACDC DC Unit 46 BBDBD ABCDA BD Unit 47 CAADB CACDB BC Unit 48 CCBCC CCDBA AB

李春葆《数据结构教程》(第4版)课后习题-查找(圣才出品)

第9章查找 1.对于有序表A[0..10],采用二分查找法时,求成功和不成功时的平均查找长度。对于有序表{12,18,24,35,47,50,62,83,90,115,134},当用二分查找法查找90时,需进行多少次查找可确定成功?查找47时,需进行多少次查找可确定成功?查找100时,需进行多少次查找才能确定不成功? 答:对于A[0..10]有序表构造的判定树如图9-1(a)所示。因此有: 对于本题给定的有序表构造的判定树如图9-1(b)所示,由此可知本题答案分别为2、4和3。 图9-1 一棵判定树 2.将整数序列{4,5,7,2,1,3,6}中的数依次插入到一棵空的二叉排序树中,试构造相应的二叉排序树,要求用图形给出构造过程,不需编写程序。 答:构造一棵二叉排序树过程如图9-2所示。

图9-2 构造二叉排序树过程 3.将整数序列{4,5,7,2,1,3,6}中的数依次插入到一棵空的平衡二叉树中,试构造相应的平衡二叉树,要求用图形的方式给出构造过程,不需编写程序。 答:构造一棵平衡二叉树过程如图9-3所示。

图9-3 构造平衡二叉树过程 4.编写一个算法,输出在一棵二叉排序树中查找某个关键字k经过的路径。 答:使用path数组存储经过的节点,当找到所要找的节点时,输出path数组中的元素值,从而输出以根节点到当前节点的路径。对应的算法如下:

查找关键字3:3425 从中看到,两者输出的路径相反,SearchBSTl()更灵活些,它可以对路径上经过的节点进行相应的处理。 5.编写一个算法,判断给定的二叉树是否是二叉排序树。 答:对二叉排序树来说,其中序遍历序列为一个递增有序序列。因此,对给定的二叉树进行中序遍历,如果始终能保持前一个值比后一个值小,则说明该二叉树是一棵二叉排序树。对应的算法如下: 6.已知一个关键字序列为if、while、for、case、do、break、else、struct、union、int、double、float、char、long、bool共15个字符串,哈希函数H(key)为关键字的第一个字母在字母表中的序号,哈希表的表长为26。 (1)若处理冲突的方法采用线性探查法,设计一个算法输出每个关键字对应的H(key)、输出哈希表并求成功情况下的平均查找长度。 (2)若处理冲突的方法采用链地址法,设计一个算法输出哈希表并计算成功情况下和

专业英语课后习题答案

Lesson2 Exercises 1. Put the following into Chinese. (1)Ohm’s law states that the voltage across a resistor is directly proportional to the current flowing through the resistor. The constant of proportionality is the resistance value of the resistor in ohms. 流过电路里电阻的电流,与加在电阻两端的电压成正比,与电阻的阻值成反比。这就是欧姆定律。 (2)Many materials, however, closely approximate an ideal linear resistor over a desired operating region. 不过,许多材料在规定的工作范围内非常接近理想线性电阻。 (3)It should be noted that an ideal voltage source (dependent or independent ) will produce any current required to ensure that the terminal voltage is as stated, whereas an ideal current source will produce the necessary voltage to ensure the stated current flow. 应该注意:一个理想电压源(独立或受控)可向电路提供任意电流以保证其端电压为规定值,而电流源可向电路提供任意电压以保证其规定电流。 (4)A different class of relationship occurs because of the restriction that some specific type of network element places on the variables. Still another class of relationship is one between several variable of the same type which occurs as the result of the network configuration, i. e., the manner in which the various element of the network are interconnected. 一种不同类型的关系是由于网络元件的某种特定类型的连接对变量的约束。另一类关系由于网络结构,即网络的不同元件互相连接的方式所产生的相同形式的一些变量间的关系。 (5)The thermal conductivity of metals is as much as several hundred times that of glass. 金属的导热率比玻璃高几百倍。 (6)Magnetic line of force will,whenever passible, travel through iron or other magnetic materials. 磁力线只要有可能就会通过铁或其它磁性材料。 (7)Actually, 0 o C is indeed the lower limit to temperatures capable of being attained. 事实上绝对零度确是所能达到的温度的最低限度。 2. Translate the following into English. (1)电路元件吸收或释放的功率为元件两端的电压与流过该元件电流的乘积。 The power absorbed or supplied by a circuit element is the product of the voltage across the element and the current through it. (2)理想独立电源是一个有源元件,它所提供的电压或电流不依赖于电路中其他变量。 An ideal independent source is an active element that provides a specified voltage or current that is completely independent of other circuit variables. (3)受控电源是一个有源元件,它所提供的电压或电流受电路中某部分电压或电流控制。 An ideal dependent (or controlled) source is an active element in which the source quantity is controlled by another voltage or current. (4)叠加定理为:线性电路中,任一电压或电流都是电路中各个独立电源单独作用时,在该处产生的电压或电流的叠加。 The superposition principle states that the voltage across (or current through) an element in a linear circuit is the algebraic sum of the voltages across (or current through) that element due to each independent source acting alone. (5)计算机可分为模拟计算机和数字计算机两种。Computers may be classfied as analog and digital.(6)新型晶体管的开关时间缩短了三分之二。The switching time of the new-type transistor is shortened three times. (7)超导体在电气应用上的重要性不能被估计过高。The importance of superconductor in the uses of electricity cannot be overestimated.

21世纪大学英语第四册课后习题答案

21世纪大学英语读写教程第四册 Unit1 1.Americans tend to define people by the jobs they have/do. Such characteristics as their family and educational backgrounds are considered less important. 美国人往往以从事的工作来对人们进行划分。家庭和教育背景这些特点被认为是不太重要的。 2.His uncompromising personality explains why he could no longer put up with his employer and eventually submitted his resignation. 他决不妥协的个性是他再也无法容忍他的雇主,并最终递交了辞职书的原因。 3.His uncompromising personality explains why he could no longer put up with his employer and eventually submitted his resignation.If you really want to learn English well, you must put in a lot of time and energy, or you'll go nowhere. The same can be said of other subjects. 如果你真想学好英语,你就必须投入大量的时间和精力,否则你就不会有任何进步。对于其他课程也可以这么说。 4.Some actors fame is built on their innate beauty, but despite his short stature, Dustin Hoffman rose above and it is his excellent acting that set him apart. 有些演员的名声靠的是他们天生的美貌,但是达斯汀?霍夫曼(Dustin Hoffman) 尽管身材矮小(short stature),还是出类拔萃,而使他与众不同的正是他精湛的演技。 5.After he took charge, we discovered that there were striking differences between him and his predecessor. He had the drive and passion, came up with many new ideas, and focused his work on how to raise our morale. 他负责管理之后,我们发现他与前任(predecessor)有明显的不同:他有干劲和激情,想出了很多新点子,并把工作重点放在如何鼓舞我们的士气上。 6.Deng Xiaoping made history when he declared China's reform and opening-up policy. Despite tremendous obstacles, he made lasting contributions to our country's modernization with his unrelenting efforts. 当邓小平宣布中国改革开放政策的时候,他被永远载入了史册。尽管障碍重重,他以不懈的努力为我国的现代化作出了永久性的贡献。 7.Why could someone with a genius IQ be left behind by a hardworking person with an average IQ? It has to be acknowledged that besides one's IQ, many other factors have much to do with one's achievements. 为什么有人拥有天才级智商却被智商平平但很刻苦的人丢在后面?承认除了智商外,还有很多别的因素与一个人的成就有着很大的关系。 8.This teacher is really remarkable in first motivating her students so she can really teach them something. It's not that she is talented, it's that she focuses completely or drawing their full attention in class. 这位教师真了不起,她能在教东西之前调动学生的积极性。这并不是因为她有天赋,而是因为她只想着在课堂上吸引他们的注意力。 Unit2 1.He glared at John and was annoyed by his refusal to cooperate. 他瞪眼看着约翰,对他拒绝合作感到恼怒。 2.John's sincere speech shows his gratitude to the people who rendered him generous help when he was in difficulty. 约翰真诚的讲话表达了他对那些在他处于困境时给过他慷慨帮助的人们的感激之情。 3.He is something of a stamp collector. The fact that once he saved up for two years to buy a rare stamp is proof of it. 3. 他可说是一个集邮家。他曾经积蓄了两年去买一张珍邮这件事便是证明。 4.The beauty of these roses could not be overstated. They took/caught all the visitors fancy in one way or another. 这些玫瑰的美丽怎么评价也不过分。他们以各种方式吸引住了所有的游客。 5.At first he took it for granted that they should build more highways in this area. Then a careful calculation of the expenditure compelled him to think twice before he made the final decision.

李春葆《数据结构教程》笔记和课后习题详解(绪论)【圣才出品】

第1章绪论 1.1 复习笔记 一、数据结构 1.概述 (1)计算机对具体问题的处理 在用计算机解决一个具体的问题时,大致需要经过以下几个步骤: ①分析问题,确定数据模型。 ②设计相应的算法。 ③编写程序,运行并调试程序,直至得到正确的结果。 (2)数据的含义 ①数据是描述客观事物的数、字符以及所有能输入到计算机中并被计算机程序处理的符号的集合。从计算机的角度看,数据是所有能被输入到计算机中,且能被计算机处理的符号的集合。它是计算机操作的对象的总称,也是计算机所处理信息的某种特定的符号表示形式。 ②数据元素是组成数据的、有一定意义的基本单位,在计算机中通常作为整体处理,有些情况下数据元素也称为元素、结点、记录等。一个数据元素可以由若干个数据项组成。数据项是具有独立含义的数据的最小单位,也称为域。 ③数据对象是性质相同的有限个数据元素的集合,它是数据的一个子集。 默认情况下,数据结构中的数据指的都是数据对象。 (3)数据结构的定义

数据结构是指所有数据元素以及数据元素之间的关系,可以看作是相互之间存在特定关系的数据元素的集合,因此,可时把数据结构看成是带结构的数据元素的集合。数据结构包括以下几个方面: ①数据元素之间的逻辑关系,即数据的逻辑结构,它是数据结构在用户面前呈现的形式。 数据的逻辑结构是从逻辑关系(主要指数据元素的相邻关系)上描述数据的,它与数据的存储无关,是独立于计算机的。因此,数据的逻辑结构可以看作是从具体问题抽象出来的数学模型。 ②数据元素及其关系在计算机存储器中的存储方式,即数据的存储结构,也称为数据的物理结构。 数据的存储结构是逻辑结构用计算机语言的实现或在计算机中的表示(也称为映像),也是指逻辑结构在计算机中的存储方式,它是依赖于计算机语言的。一般情况下,只在高级语言(如C、C++、Java语言)的层次上讨论存储结构。 ③施加在该数据上的操作,即数据的运算。 数据的运算是定义在数据的逻辑结构之上的,每种逻辑结构都有一组相应的运算。最常用的运算有检索、插入、删除、更新、排序等。数据的运算最终需要在对应的存储结构上用算法实现。 因此,数据结构是一门讨论“描述现实世界实体的数学模型(通常为非数值计算)及其之上的运算在计算机中如何表示和实现”的学科。 2.数据的逻辑结构 讨论数据结构的目的是为了用计算机求解问题,分析并弄清数据的逻辑结构是求解问题的基础。 数据的逻辑结构是用户根据需要建立起来的数据组织形式,它反映数据元素之间的逻辑

李春葆《数据结构教程》(第4版)课后习题-串(圣才出品)

第4章串 1.采用顺序结构存储串,编写一个实现串通配符匹配的算法pattern______index(),其中的通配符只有“?”,它可以和任一字符匹配成功,例如,pattern______index(″? re″,″there are″)返回的结果是2。 答:本题的基础是Brute—Force模式匹配算法,只是增加了“?”的处理功能。对应的算法如下: 2.有两个串s1和s2,设计一个算法求这样一个串,该串中的字符是s1和s2中的公共字符。 答:扫描s1,对于当前字符s1.data[i],若在s2中,则将其加入到串s3中。最后返回s3串。对应的算法如下:

3.设目标为t=’abcaabbabcabaacbacba’,模式p=’abcabaa’。(1)计算模式P的nextval函数值。 (2)不写算法,只画出利用KMP算法进行模式匹配时的每一趟匹配过程。答:(1)先计算next数组,在此基础上求nextval数组,如表4-1所示。 表4-1 计算next数组和nextval数组 (2)采用KMP算法求子串位置的过程如下(开始时i=0,j=0): 第1趟匹配: 此时i=4,j=4,匹配失败,而nextval[4]=0,则i=4,j=nextval[4]=0,即:

第2趟匹配: 此时i=6,j=2,匹配失败,而nextval[2]=0,则i=6,j=nextval[2]=0,即: 第3趟匹配: 此时i=6,j=0,匹配失败,而nextval[0]=-1,则i=6,j=nextval[0]=-1。因j=-1,执行i=i+1=7,j=j+1=0,即: 第4趟匹配: 此时i=14,j=7,匹配成功,返回v=i-t.1ength=14-7=7。 上机实验题4 实验题1编写一个程序algo4-1.cpp,实现顺序串的各种基本运算,并在此基础上设计一个程序exp4-1.cpp完成如下功能: (1)建立串s=″abcdefghefghijklmn″和串sl=″xyz″; (2)输出串s; (3)输出串s的长度;

大学英语精读第四册课后题词汇答案.doc

Unit 1 1. A thoughtful person thinks before speaking and considers the feelings of others. 2. The library is closing. We might/may/could as well go home. 3. I ’d like to draw your attention to the fact that there is some sense after all in the speaker ’s non sense. 4.Harry has a vivid imagination; he can make up marvelous stories. 5.Although Margie was swimming so well, she failed to win the first prize and had to settle for the second. 6. I ’m quite determined to have the thing finished and done with before leaving the office. https://www.doczj.com/doc/2f4953086.html,petitive sports are recommended to young adults to prepare them for the competitive world of college and business. 8.It pains/pained me to admit that I was such a fool as to repeat the mistake. 9.My boss paid me and added a bonus for the new customers I had signed up. 10.A soldier should never shrink from the duty of defending his country even in the face of certain death. 11. Due to exceptionally bad weather, the ship arrived late and the delivery of goods was not on time. 12. My wife was rather embarrassed when she overheard some of our guests say they didn ’t like the meal she’d cooked for them. 13.People in my hometown tend to eat more sour food on hot summer days presumably because it could help quench their thirst. 14.In the United States it is quite easy to find a place for rent, but the high cost keeps many young people away. 15.The professor was reluctant to stop grading the stack of papers on her desk, but she was really too tired to read on. 16.Bacteria reproduce themselves by splitting into two. Unit 2 1. The changes in the firm ’s policy will have to be fundamental if they are to have any effect on its future. https://www.doczj.com/doc/2f4953086.html,st month I deposited 50 yuan in my savings account, but this month I had to draw 200 to pay for the mp3 player. 3.State financial support given in the form of scholarships has stimulated the students to greater efforts. 4. If you spare half an hour for exercises every day you’ll soon be back in good condition/in condition. 5.The US dollar fell yesterday against most foreign currencies. 6.A country should protect its natural resources by fighting against waste. 7. You can increase a tyre ’s grip in winter by slightly lowering its pressure. 8. Scientists first conceived the idea of the atomic bomb in the 1930s.

相关主题
文本预览
相关文档 最新文档