数据结构英文版课件1DataStructuresCourse

上传人:仙*** 文档编号:241899059 上传时间:2024-08-03 格式:PPTX 页数:20 大小:523.52KB
返回 下载 相关 举报
数据结构英文版课件1DataStructuresCourse_第1页
第1页 / 共20页
数据结构英文版课件1DataStructuresCourse_第2页
第2页 / 共20页
数据结构英文版课件1DataStructuresCourse_第3页
第3页 / 共20页
点击查看更多>>
资源描述
计算机学院计算机学院 谢芳谢芳Data Structures Using C2017-2-21Data Structures 1/9计算机学院 谢芳Data Structures Using 2017-2-21Data Structures 2/9Prerequisites(Backgrounds)Good knowledge of C ProgrammingA course in discrete mathematics2017-2-21Data Structures 2/9Pr2017-2-21Data Structures 3/9Grading Schemes1.Homework+Attendance(20%)2.Programming(20%)3.Terminal Examination(60%)2017-2-21Data Structures 3/9Gr2017-2-21Data Structures 4/9RecommendedReferenceTextbook:1.A Practical Introduction to Data Strcutres and Algorithm Analysis,Clifford A.Shaffer.2.,严严蔚敏,吴蔚敏,吴伟伟民民编编著,清著,清华华大学出版社。大学出版社。Course MaterialRequired Textbook:Structures,Algorithm Analysis,the electronic book.2017-2-21Data Structures 4/9Re2017-2-21Data Structures 5/9Contents1.Data Structures-An Overview2.Sequential Lists3.Stacks4.Queues5.Linked Lists6.Trees7.Graphs8.Sorting9.Searching2017-2-21Data Structures 5/9Co2017-2-21Data Structures 6/9Why C?Modular procedural language with arrays,structures,and referencesExperimental toolVC 6.0VS 2008C vs.C+or Javasmall,clean,simplecan support learning data structures without learning too much language extras2017-2-21Data Structures 6/9Wh2017-2-21Data Structures 7/9Learning Data StructuresWHY?WHAT?HOW?Practise!Practise!Practise!2017-2-21Data Structures 7/9Le2017-2-21Data Structures 8/9Why we use Data Structures?It should go without saying that people write programs to solve problems.However,it is crucial to keep this truism in mind when selecting a data structure to solve a particular problem.Only by first analyzing the problem to determine the performance goals that must be achieved can there be any hope of selecting the right data structure that they are familiar with but which is inappropriate to the problem.2017-2-21Data Structures 8/9Wh2017-2-21Data Structures 9/9Purpose/GoalsData Structures-if your program needs to store a few things-number,payroll records,or job descriptions for example-the simplest and most effective approach might be to put them in a list(in c array).Only when you have to organize and search through a large number of things do more sophisticated data structures usually become necessary.2017-2-21Data Structures 9/9Pu2017-2-21Data Structures 10/9How to use Data Structures?When selecting a data structure to solve a problem,you should follow these steps:1.Analyze your problem to determine the basic operations that must be supported.Examples of basic operations include inserting a data item into the data structure,deleting a data item from the data structure,and finding a specified data item.2.Quantify the resource constraints for each operation.3.Select the data structure that best meets these requirements.2017-2-21Data Structures 10/9H2017-2-21Data Structures 11/9Abstract Data Types and Data Structures The previous pages used the terms“data item”and“data structure”without properly defining them.This section presents terminology and motivates the design process embodied in the three-step approach to selecting a data structure.This motivation stems from the need to manage the tremendous complexity of computer programs.2017-2-21Data Structures 11/9A2017-2-21Data Structures 12/9Data Types(DT)A type is a collection of values.For example,-The Boolean type consists of the values true and false.The integers also form a type.An integer is a simple type because its values contain no subparts.-A bank account record will typically contain serval pieces of information such as name,address,account number,and account balance.Such a record is an example of an aggregate type or composite type.2017-2-21Data Structures 12/9D2017-2-21Data Structures 13/9Data Types(DT)-A data item is a piece of information or a record whose value is drawn from a type.A data item is said to be a member of a type.-A data type is a type together with a collection of operations to manipulate the type.For example,an integer variable is a member of the integer data type.Addition is an example of an operation on the integer data type.2017-2-21Data Structures 13/9D2017-2-21Data Structures 14/9Abstract Data Types(ADT)An abstract data type is the realization of a data type as a software component.The interface of the ADT is defined in terms of a types and a set of operations on that type.The behavior of each operation is determined by its inputs and outputs.An ADT does not specify how the data type is implemented.These implementation details are hidden from the user of the ADT and protected from outside access,a concept referred to as encapsulation.(An ADT must be defined before we use it)2017-2-21Data Structures 14/9A2017-2-21Data Structures 15/9Distinction of Logical Concept of a data type and its physical implementation in a computer programIn a computer program,there are two traditional implementations for the list data type:the linked list and array-based list.The list data type can therefore be implemented using a linked list or an array.“Array”is commonly used in computer programming to mean a contiguous block of memory location,where each memory location stores one fixed-length data item.By this meaning,an array is a physical data structure.2017-2-21Data Structures 15/9D2017-2-21Data Structures 16/9Distinction of Logical Concept of a data type and its physical implementation in a computer programHowever,array can also mean a logical data type composed a collection of data items,with each data item identified by an index number(in c programming language,it uses pointer to represent the index).It is possible to implement arrays in many different ways.2017-2-21Data Structures 16/9DADT Example:Array:Fixed length string method#Example:char*str;str=“CHINA”;012345Advantage:simple.Disadvantage:possible wastage of memory space;complex operations.str0str19NULL6.19C H IN A0.ADT Example:#Example:char*stLinked list methodAdvantage:no wastage of memory space;memory allocation is dynamic;simpler operations.Disadvantage:accessing a substring requiredstrating from the beginning;required more memory space.Linked list methodAdvantage:nSingly Linked liststruct node chardata;struct node*next;struct node*header,*string;Logical Representation of stringPhysical Representation of string(header)data nextS20C30U10header40TPhysical Space TNULL001070Address:20C3030U1040S207040Singly Linked liststruct node2017-2-21Data Structures 20/9 Discuss1.What is Data Structures?2.What is ADT?3.What is the distinction of logical conception and physical implementation?2017-2-21Data Structures 20/9
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!