您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 经营企划 > 第-4-章数据结构习题题目及答案-串
为搞好山东省交通科学研究所研发基地项目的结算审计工作,我跟踪审计部特针对本项目作如下要求,请各施工单位、供货单位遵照执行:andperformancetestcopiesoftherecord.Ifnecessary,reviewshouldbecarriedout;4)forspringhangers(includedsimplespring,hangersandconstantsupporthangers)itshouldalsoberecognizedassettingandlockingofloads.5)checkthesurfacequality,foldedlayeringandwithoutcracks,rustandotherdefects.5)aftercompletionofthetestandcontroldrawingnumberonebyone,byseriesbaled.Coloralloysteelparts,thepartsmarkinginstallationlocationandrotationaboutthedirectionyouwant.7.3.14.hangersinstallation7.3.14.1hangerlayouta.acleardesignofhangershouldbeinstalledstrictlyinaccordancewiththedrawingsanddesignsshallnotbeinstalledwrong,missing,etc.B.ownarrangementofpipingsupportandhangersetandselectionshouldbebasedoncomprehensiveanalysisofgenerallayoutofpipingsystems;coldinstallationofsteampipewithparticularattentionreservedforcompensationofthermalexpansiondisplacementandorientation.C.supportsystemsshouldberationaltowithstandpipeloads,staticloadandincidentalload;reasonablepipingdisplacement;guaranteedundervariousconditions,stressarewithintheallowedrange.Strength,stiffness,andmeetrequirementstopreventvibrationandsoothingwater,withoutaffectingtheadjacentequipmentmaintenanceandotherpipinginstallationandexpansion.D.equipmentconnectedtotheinterfacetomeetpipelinethrust(torque)limitrequirements;increasethestabilityofpipingsystemstopreventpipeline...Tubewallthickness(mm)2-34-67-10weldformnoslopemouthweldstrengtheningheighth(mm)1-1.51.5-2weldwidthb(mm)5-67-6hasslopemouthweldstrengtheningheighth(mm)1.5-22weldwidthb(mm)coverhadeachedgeslopemouthabout2mmargonarcweldingweldstrengtheningsurfaceheightandwidthtubewallthickness(mm)2--33--45--6weldformweldstrengtheningheighth(mm)1-1.51.5-22-2.5widthb(mm)一、基础知识题4.1简述下列每对术语的区别:空串和空格串;串常量与串变量;主串和子串;串变量的名字和串变量的值;静态分配的顺序串与动态分配的顺序串。【解答】不含任何字符的串称为空串,其长度为0。仅含有空格字符的串称为空格串,其长度为串中空格字符的个数。空格符可用来分割一般的字符,便于人们识别和阅读,但计算串长时应包括这些空格符。空串在串处理中可作为任意串的子串。用引号(数据结构教学中通常用单引号,而C语言中用双引号)括起来的字符序列称为串常量,其串值是常量。串值可以变化的量称为串变量。串中任意个连续的字符组成的子序列被称为该串的子串。包含子串的串又被称为该子串的主串。子串在主串中第一次出现时的第一个字符的位置称子串在主串中的位置。串变量与其它变量一样,要用名字引用其值,串变量的名字也是标识符,串变量的值可以修改。串的存储也有静态存储和动态存储两种。静态存储指用一维数组,通常一个字符占用一个字节,需要静态定义串的长度,具有顺序存储结构的优缺点。若需要在程序执行过程中,动态地改变串的长度,则可以利用标准函数malloc()和free()动态地分配或释放存储单元,提高存储资源的利用率。在C语言中,动态分配和回收的存储单元都来自于一个被称之为“堆”的自由存储区,故该方法可称为堆分配存储。类型定义如下所示:typedefstruct{char*str;intlength;}HString;4.2设有串S=’good’,T=’I︼am︼a︼student’,R=’!’,求:(1)StringConcat(T,R)(2)SubString(T,8,7)(3)StringLength(T)(4)Index(T,’a’)(5)StringInsert(T,8,S)(6)Replace(T,SubString(T,8,7),’teacher’)【解答】(1)StringConcat(T,R)=’I︼am︼a︼student!’(2)SubString(T,8,7)=’student’(3)StringLength(T)=14(4)Index(T,’a’)=3(5)StringInsert(T,8,S)=’I︼am︼a︼goodstudent’(6)Replace(T,SubString(T,8,7),’teacher’)=’I︼am︼a︼teacher’4.3若串S1=‘ABCDEFG’,S2=‘9898’,S3=‘###’,S4=‘’,执行concat(replace(S1,substr(S1,length(S2),length(S3)),S3),substr(S4,index(S2,‘8’),length(S2)))操作的结果是什么?【解答】concat(replace(S1,substr(S1,length(S2),length(S3)),S3),substr(S4,index(S2,‘8’),length(S2)))=concat(replace(S1,substr(S1,4,3),S3),substr(S4,2,4))=concat(replace(S1,’DEF’,S3),’1234’)为搞好山东省交通科学研究所研发基地项目的结算审计工作,我跟踪审计部特针对本项目作如下要求,请各施工单位、供货单位遵照执行:andperformancetestcopiesoftherecord.Ifnecessary,reviewshouldbecarriedout;4)forspringhangers(includedsimplespring,hangersandconstantsupporthangers)itshouldalsoberecognizedassettingandlockingofloads.5)checkthesurfacequality,foldedlayeringandwithoutcracks,rustandotherdefects.5)aftercompletionofthetestandcontroldrawingnumberonebyone,byseriesbaled.Coloralloysteelparts,thepartsmarkinginstallationlocationandrotationaboutthedirectionyouwant.7.3.14.hangersinstallation7.3.14.1hangerlayouta.acleardesignofhangershouldbeinstalledstrictlyinaccordancewiththedrawingsanddesignsshallnotbeinstalledwrong,missing,etc.B.ownarrangementofpipingsupportandhangersetandselectionshouldbebasedoncomprehensiveanalysisofgenerallayoutofpipingsystems;coldinstallationofsteampipewithparticularattentionreservedforcompensationofthermalexpansiondisplacementandorientation.C.supportsystemsshouldberationaltowithstandpipeloads,staticloadandincidentalload;reasonablepipingdisplacement;guaranteedundervariousconditions,stressarewithintheallowedrange.Strength,stiffness,andmeetrequirementstopreventvibrationandsoothingwater,withoutaffectingtheadjacentequipmentmaintenanceandotherpipinginstallationandexpansion.D.equipmentconnectedtotheinterfacetomeetpipelinethrust(torque)limitrequirements;increasethestabilityofpipingsystemstopreventpipeline...Tubewallthickness(mm)2-34-67-10weldformnoslopemouthweldstrengtheningheighth(mm)1-1.51.5-2weldwidthb(mm)5-67-6hasslopemouthweldstrengtheningheighth(mm)1.5-22weldwidthb(mm)coverhadeachedgeslopemouthabout2mmargonarcweldingweldstrengtheningsurfaceheightandwidthtubewallthickness(mm)2--33--45--6weldformweldstrengtheningheighth(mm)1-1.51.5-22-2.5widthb(mm)=concat(‘ABC###G’,’1234’)=‘ABC###G1234’4.4设S为一个长度为n的字符串,其中的字符各不相同,则S中的互异的非平凡子串(非空且不同于S本身)的个数是多少?【解答】长度为n的字符串中互异的非平凡子串(非空且不同于S本身)的个数计算如下:长度为1的子串有n个,长度为2的子串有n-1个,长度为3的子串有n-2个,……,长度为n-1的子串有2个,长度为n的子串有1个(按题意要求这个子串就是S本身,不能计算在总数内)。故子串个数为:(2+n)*(
本文标题:第-4-章数据结构习题题目及答案-串
链接地址:https://www.777doc.com/doc-1778283 .html