1 / 26
文档名称:

数据结构与算法分析-C语言(英文版).ppt

格式:ppt   大小:1,197KB   页数:26
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

数据结构与算法分析-C语言(英文版).ppt

上传人:lily8501 2017/12/9 文件大小:1.17 MB

下载得到文件列表

数据结构与算法分析-C语言(英文版).ppt

相关文档

文档介绍

文档介绍:CHAPTER 3
Lists, Stacks, and Queues
§1 Abstract Data Type (ADT)
【Definition】Data Type = { Objects } { Operations }
〖Example〗 int = { 0, 1, 2, , INT_MAX, INT_MIN }
{ , , , , , }
【Definition】An Abstract Data Type (ADT) is a data type that anized in such a way that the specification on the objects and specification of the operations on the objects are separated from the representation of the objects and the implementation on the operations.
§2 The List ADT
Objects: ( item0, item1, , itemN1 )
Operations:
 Finding the length, N, of a list.
 Printing all the items in a list.
 Making an empty list.
 Finding the k-th item from a list, 0  k < N.
 Inserting a new item after the k-th item of a list, 0  k < N.
 Deleting an item from a list.
 Finding next of the current item from a list.
 Finding previous of the current item from a list.
 ADT:
Why after?
1. Simple Array implementation of Lists
§2 The List ADT
array[ i ] = itemi
 MaxSize has to be estimated.
Address
Content
array+i
itemi
array+i+1
itemi+1
……
……
……
……
Sequential mapping
 Find_Kth takes O(1) time.
 Insertion and Deletion not only take O(N) time, but also involve a lot of data movements which takes time.
§2 The List ADT
2. Linked Lists
Address
Data
Pointer
0010
0011
0110
1011
SUN
QIAN
ZHAO
LI
1011
0010
0011
NULL
Head pointer ptr = 0110
ZHAO
QIAN
SUN
LI
ptr
NULL
Initialization:
typedef struct list_node *list_ptr;
typedef struct list_node {
char data [ 4 ] ;
list_ptr next ;
} ;
list_ptr ptr ;
To link ‘ZHAO’ and ‘QIAN’:
list_ptr N1, N2 ;
N1 = (list_ptr)malloc(sizeof(struct list_node));
N2 = (list_ptr)malloc(sizeof(struct list_node));
N1->data = ‘ZHAO’;
N2->data = ‘QIAN’;
N1->next = N2 ;
N2->next = NULL ;
ptr = N1 ;
ZHAO
QIAN
ptr
NULL
Locations of the nodes may
change on different runs.
§2 The List ADT
a1
ptr
NULL
ai
ai+1
an
...
...
Insertion
node
b
temp
 temp->next =
node->next
 node->next = temp
Question: What wil

最近更新

2026福建省面向中国药科大学选调生选拔工作参.. 49页

2026年四川文化产业职业学院单招职业适应性考.. 43页

基于深度学习的遥感图像耕地提取方法研究 7页

基于OMIPOLDER卫星数据与AERONET地面观测的气.. 6页

2025年秋季黄冈市部分高中高三年级期中考试语.. 5页

2025广西南宁市良庆区大沙田街道办事处招聘1人.. 47页

2025江苏扬州市明月湖运营管理有限公司招聘专.. 44页

2025河南黄淮学院招聘高层次人才89人考试参考.. 48页

2025福建省思进拍卖有限公司福建省贸托拍卖有.. 44页

2025重庆大足区教育事业单位面向应届生考核招.. 45页

2026云南省面向南京邮电大学选定高校招录优秀.. 48页

2026年(完整版)C语言试题学生专用 13页

2026年C语言专升本真题(精选题) 13页

2026年c语言循环程序设计题目(必刷) 13页

2026年C语言期末试题北京卷及答案(典优) 13页

2026年c语言知识测试题【word】 13页

2026年C语言程序设计理论试题库及答案(易错题.. 13页

2026年c语言编程练习题及答案(全国通用) 13页

2022黑龙江哈尔滨市公开选调公务员76人(公共.. 40页

2026年C语言题库及参考答案1套 13页

2026年上海立信会计金融学院单招综合素质考试.. 44页

2024年北京舞蹈学院辅导员考试笔试题库最新 36页

2026年中国城市建设史复习题100道附完整答案(.. 44页

2024年大兴安岭职业学院辅导员考试笔试真题汇.. 31页

2024年山西财贸职业技术学院辅导员招聘备考题.. 30页

2026年安徽城市管理职业学院单招职业适应性考.. 37页

2025年湖南省建设工程工程量清单计价办法(新).. 51页

2025年江西信息应用职业技术学院单招职业适应.. 127页

2025年江西信息应用职业技术学院单招职业倾向.. 73页

喝酒给老婆的检讨书 6页