数据结构 第一章 Chapter 1.pptVIP

  • 0
  • 0
  • 约1.45万字
  • 约 60页
  • 2018-04-12 发布于江西
  • 举报
数据结构 第一章 Chapter 1.ppt

Storage Containers ( General ) Storage Containers ( Vectors) A vector has all of the nice indexing features of an array along with the ability to dynamically grow to meet demand. Storage Containers ( Vectors) A vector is a super-array“, meaning all familiar array algorithms work. You also have the freedom to to grow or shrink (收缩)it. Storage Containers ( Vectors) Vectors allow for direct access to their elements through an index, but are not efficient storage structures for: insertion of items at arbitrary positions in a list. deletion of items at arbitrary positions in a list. Storage Containers ( Lists ) list container each element has a reference that identifies the next item in the list. Adding a new item involves breaking a link in the chain and creating two new links to connect the item. Storage Containers ( Maps ) First Look at ADTs Implementations For a programming task we must identify The collection of data items Basic operations to be performed on them Taken together (data items operations) are called an Abstract Data Type (ADT) Implementation Storage structures for the data items Algorithms for the operations (参见第2章) Data Structures, Abstract Data Types, and Implementations Consider example of an airplane flight with 10 seats to be assigned Tasks List available seats Reserve a seat How to store, access data? 10 individual variables An array of variables (参见第3章) Abstract Data Types ADT Operation Description operationName: Action statement that specifies the input parameters, the type of operation on the elements of the data structure, and the output parameter. Preconditions: Necessary conditions that must apply to the input parameters and the current state of the object to allow successful execution of the operation. Postconditions: Changes in the data of the structure caused by the o

文档评论(0)

1亿VIP精品文档

相关文档