《数据结构的算法在C++中的应用》(英文版)Chapter 3 Linear List

Chapter 3 Linear list
Chapter 3 Linear List

3.1 Preface 1. data object- a set of instances or values for example Booleanfalse, true) Digit={0,1,2,3,4,56,78,9} Letter-A B,..Z, a, b,...Z) NaturalNumber= 0, 1, 2,.. Integer={0,+1,-1,+2,-2,+3,-3,…} Stringa,b aa. ab. ac
3.1 Preface 1. data object--- a set of instances or values for example: Boolean={false,true} Digit={0,1,2,3,4,5,6,7,8,9} Letter={A,B,……Z,a,b,……z} NaturalNumber={0,1,2,……} Integer = {0, +1, -1, +2, -2, +3, -3, …} String={a,b,……,aa, ab, ac,……}

3.1 Preface 2. data structure is a data object together with the relationships among the instances and among the individual elements that compose an instance Data Structure=D, R) D---data object R-a set of relationships of all the data members in D
3.1 Preface 2.data structure is a data object together with the relationships among the instances and among the individual elements that compose an instance • Data_Structure={D,R} • D---data object, • R ---a set of relationships of all the data members in D

3.2 Linear list L=( list size is n if n=0: empty list ifn>o is the first'th(or front)element e. is the last element e; immediately precedes eit
3.2 Linear List L = (e1 , e2 , e3 , …, en ) list size is n if n=0: empty list if n>0: e1 is the first’th (or front) element en is the last element ei immediately precedes ei+1

3.2 Linear list Example Students=Jack, Jill, Abe, Henry, Mary. Judy) Exams=(examl, exam2, exam) Days of Week=(S, M, T, W, Th, F, Sa Months=(Jan, Feb, Mar, Apr,., Nov, Dec
3.2 Linear List Example: Students =(Jack, Jill, Abe, Henry, Mary, …, Judy) Exams =(exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, …, Nov, Dec)

3.2 Linear list operations Create a linear list determine whether the list is empty determine the length of the list find the kth of the element search for a given element delete the kth element insert a new element just after the kth
3.2 Linear List Operations: Create a linear list determine whether the list is empty determine the length of the list find the kth of the element search for a given element delete the kth element insert a new element just after the kth

3.2 Linear list adt specification of a linear list AbstractDate Type Linearlist i instances ordered finite collections of zero or more elements operations CreateD Destroyo IsEmpty (; Length Find(k, x) earch(X Delete(k, x); Insert(k, x) Output(out)
3.2 Linear List ADT specification of a linear list AbstractDateType LinearList { instances ordered finite collections of zero or more elements operations Create(); Destroy(); IsEmpty(); Length(); Find(k,x); Search(x); Delete(k,x); Insert(k,x); Output(out); }

3.3 Formula-based Representation 1. Use an array to represent the instance of an object Element 1 2 maxsize -I e1.e ength each position of the array is called a cell or a node mapping formula: location(i=i-1
3.3 Formula-based Representation 1. Use an array to represent the instance of an object (e1 ,e2 ,………en ) length=n each position of the array is called a cell or a node mapping formula:location(i)=i-1 e1 e2 e3 en Element 0 1 2 n-1 maxsize-1

3. 3 Formula-based Representation 2. Class definition: program 3. 1 template class Linearlist i public Linearlist(int Maxlistsize =10) Linearlistoi delete[ element bool isemptyo const return length==0; 1 int Length( const(return length) bool find(int k, T&x) const int Search(const T&x)const Linearlist & delete(int k, T&x Linearlist & insert(int k, const T&x) void Output(ostream& out)const private int length; int MaxSize; T*element
3.3 Formula-based Representation 2. Class definition: program 3.1 template class LinearList{ public: LinearList(int MaxListSize =10); ~ LinearList(){ delete [] element;}; bool IsEmpty() const {return length= =0;} int Length() const (return length); bool Find(int k,T&x) const; int Search(const T&x) const; LinearList & Delete(int k,T&x); LinearList & Insert(int k, const T&x); void Output(ostream& out) const; private: int length; int MaxSize; T* element; }

3.3 Formula-based Representation 3. operations 1)Constructor template : Linearlist(int MaxListSize) MaxSizemaxlistSize element=new T[MaxSize] length=0
3.3 Formula-based Representation 3. Operations: 1) Constructor: template LinearList::LinearList(int MaxListSize) { MaxSize=MaxListSize; element=new T[MaxSize]; length=0; }
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《数据结构的算法在C++中的应用》(英文版)Chapter 2 Program performance.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 1 preface.ppt
- 《数据结构的算法在C++中的应用》(英文版)Textbook.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第9章 宏.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第8章 数据访问页.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第7章 建立Access报表.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第6章 Access窗体的操作.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第5章 查询的创建及应用.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第4章 建构Access数据库表.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第3章 创建Access数据库.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第2章 Access 2002应用基础.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第1章 数据库原理及基本概念.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第12章 综合实例应用.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第11章 Access数据库的管理.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)第10章 Access模块和应用程序设计.ppt
- 《Access数据库应用教程》教学资源(PPT课件讲稿)各章习题参考答案.ppt
- 西北工业大学:《计算机系统结构》总复习及模拟试题.ppt
- 西北工业大学:《计算机系统结构》总复习.ppt
- 西北工业大学:《计算机系统结构》第4章 直接映象及其变换.ppt
- 西北工业大学:《计算机系统结构》第3章 习题处理.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 4 Arrays and Matrix.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 5 Stack.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 6 Queue.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 7 Hashing.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 8 Binary and other trees.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 9 Priority Queues.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 11 Search Trees.ppt
- 《数据结构的算法在C++中的应用》(英文版)Chapter 12 Graphs.ppt
- 四川电力职业技术学院:《ASP网络程序设计》目录.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第五章 数据库基础知识.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第二章 ASP初步.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第一章 网络程序设计概述.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第三章 ASP脚本语 VBScript.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第四章 ASP常用内部对象.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第六章 ASP数据库编程.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第八章 使用第三方组件.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第七章 文件存取组件及其它组.ppt
- 四川电力职业技术学院:《ASP网络程序设计》第一章 网络程序设计概述.ppt
- 《ASP动态网页设计》电子教案.doc
- 《ASP动态网页设计》教学大纲.doc