ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:186.80KB ,
资源ID:158130      下载积分:15 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/158130.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文((第1版)数据结构实验指导(精选).docx)为本站会员(b****9)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

(第1版)数据结构实验指导(精选).docx

1、3 Projects3.1 Project 1: Performance Measurement9Given a list of orderedN integers, numbered from 0 toN 1, checking to see that N is notin this list provides a worst case for many search algorithms.Consider two algorithms: one is called “sequential search” which scans through the list from left to r

2、ight; and the other is “binary search” which is given on page 24(Figure 2.9) of your textbook. Your tasks are:(1) Implement an iterative version and a recursive version of sequential search;(2) Implement an iterative version of binary search;(3) Analyze the worst case complexities of the above two v

3、ersions of sequential search and that of binary search;(4) Measure and compare the worst case performances of the above three functions forN = 100,500,1000,2000,4000,6000,8000,10000.To measure the performance of a function, we may use Cs standard library time.h as the following:Note: If a function r

4、uns so quickly that it takes less than a tick to finish, we may repeat the function calls for K times to obtain a total run time(“Total Time”), and then divide the total timeby Kto obtain a more accurate duration(“Duration”) for a single fun of the function. Therepetition factor must by large enough

5、 so that the number of elapsed ticks is at least 10 if we want an accuracy of at least 10%.The test results must be listed in the following table:The performances of the three functions must be plotted in the sameN -run_time coordinatesystemforillustration.3.2 Project 2: Implementation of Lists, and

6、 PolynomialProblems1. Merge two ordered lists into a new linked list in which the nodes are also in this order. If lengths of original two lists are m and n, the length of new linked list is m + n.For example:Input:5 (length of list 1)42646569511 (length of list 2)1517263046485658829095Output:415172

7、63046485658829095Demands:(1). You should use single linked list(with a header) to create the functions MakeEmpty, IsEmpty, IsLast, Find, Delete, FindPrevious, Insert, DeleteList, Header, First, Advance, Retrieve(See P40,Figure3.6).(2). Using above functions to solve this problem.(3). The linked impl

8、ementation of list should be written in separated files (.cpp and .h) in the VC+ workspace.Their names should be linkedlist.h, linkedlist.cpp, merge.cpp.2. The declarations that follow give us the polynomial ADT. Structure Polynomial isObject:P(x) = a xe1 +L+ a xen ;a set of ordered pairs of where a

9、 is1the coefficient and eiOperations:niis the exponent. ei are nonnegative integers.For all poly,poly1,poly2Polynomial,coefCoefficients, exponExponents Polynomial Zero():= return the polynomial, P(x)=0Boolean IsZero(poly):= if (poly) return FALSE;else return TRUE;Coefficient Coef(poly, expon):= if (

10、expon poly) return its coeffientelse return zero.Exponent Lead_Exp(poly):= return the largest exponent in poly.Polynomial Attach(poly, coef, expon):= if (expon poly) return errorelse return the polynomial poly with the term inserted.Polynomial Remove(poly, expon):= if (expon poly) return the polynom

11、ial poly withthe term whose exponent is expon deletedelse return error.Polynomial SingleMult(poly, coef, expon) := return the polynomial poly*coef*x exponPolynomial Add(poly1,poly2):= return the polynomial poly1 + poly2. Polynomial Mult(poly1,poly2):= return the polynomial poly1 * poly2. end Polynom

12、ialDemands:(1). You should choose a suitable representation for Polynomial.(2). You should create the functions Zero, IsZero, Coef, Lead_Exp, Attach, Remove, SingleMult, Add, Mult, and test them.(3). IfA(x) = 3x20 + 2x5 + 4 and B(x) = 3x4 + 2x3 + 3x2 +1 , write a function to use abovefunctions to co

13、mpute C(x) = A(x) + B(x) and D(x) = A(x)* B(x) .(4). Analyze advantages of your representation.(5). The implementation of polynomial ADT should be written in separated files (.cpp and .h) in the VC+ workspace.Their names should be Polynomial.h, Polynomial.cpp, main.cpp.Note:Your program must read fr

14、om a file “input.txt” and write to a file “output.txt” in the current directory.3.3 Project 3: Implementation and Applications of StacksProblems1. Write a Conversion function to converse any decimal data to binary version.Demands:(1). Implement Stack ADT using linked list representation, which must

15、at least has five basic operations: Create , IsFull, Push , IsEmpty and Pop.(2).Build a new project to implement the Conversion function. The input and output should be according to the following format:Please input the decimal number: 15The corresponding binary version is: 1111Please input the decimal number: -1Bye!2. Write a program to judge whether a bracket sequence (maybe has other letters) is “matching”. The “matching” means that if there ha

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1