Data structures
1. logical structure
linear structure
- Linear List
- Stack
- Queue
nonlinear structure
- Tree
- Graph
- Set
2. storage structure(physical structure)
-
- Sequential storage structure
- Linked storage structure
- Index storage structure
- Hash stroage structure
3. Data operation
#include "stdio.h"
#define stuMaxSize 1000;
type struct{
int studentNumber;
char name;
bool gender;
short age;
short weight
}stu;
stu *stuSet = (stu*)malloc(sizeof(stu)*stuMaxSize);
bool initStu(stu &stuSet);
char getStuName(int stuNum);
bool addStu(int stuNum,char stuName,bool stuGender,short age,short weight,stu &stuSize);
void sortStuNum(stu &stuSet,stu );
Algorithms
5 important features
- Finiteness
- Definiteness
- Effectiveness
- Input
- Output
goals
- Correctness
- Readability
- Robustness
- High efficiency & Low storage requirements
Time complexity & Space complexity
Exercise
一、选择题
01.可以用( D )定义一个完整的数据结构。
A.数据元素 B.数据对象
C.数据关系 D.抽象数据类型
02.以下数据结构中,( A )是非线性数据结构。
A.树 B.字符串
C.队列 D.栈
03.以下属于逻辑结构的是( C )。
A.顺序表 B.哈希表
C.有序表 D.单链表
04.·以下与数据的存储结构无关的术语是( A )。
A.循环队列 B.链表
C.哈希表 D.栈
05.以下关于数据结构的说法中,正确的是( A )。
A.数据的逻辑结构独立于其存储结构
B.数据的存储结构独立于其逻辑结构
C.数据的逻辑结构唯一决定其存储结构
D.数据结构仅由其逻辑结构和存储结构决定
06.在存储数据时,通常不仅要存储各数据元素的值,而且要存储( B )。
A.数据的操作方法 B.数据元素的类型
C.数据元素之间的关系 D.数据的存取方法
07.链式存储设计时,结点内的存储单元地址( C )。
A.一定连续 B.一定不连续
C.不一定连续 D.部分连续,部分不连续
二、综合应用题
01.对于两种不同的数据结构,逻辑结构或物理结构一定不相同吗?
Binary tree
02.试举一例,说明对相同的逻辑结构,同一种运算在不同的存储方式下实现时,其运算效率不同
Linear list (sequencial storage structure) O(1)=RU O(n)=CD CRUD
Linear lisr(linked storage structure) O(n)=RU O(1)=CD