数据结构1-3

P1 数据结构: 课程导论
Abstract data types(ADTs)
Arrays
Linked List
stack
queue
Tree
Graph

1)Logical view
2)operations
3)cost at operations
4)Implementation

P2 抽象数据类型(ADT)
List as abstracy data type
List - store a given number of elements at a given data type
     - write /modify element at a position
     - read element at a position
Are you talking about arrays?
it has the functions

List - empty list has size 0
     - insert
     - remove
     - count
     - read /modify element at a position
     - apecity data-type
     
数组的大小是有限的


P3     链表基本介绍(Linked List)
typedef struct Node {
    int data;  //4 bytes
    Node* next;   //4 bytes
} Node;
head node 头节点的地址可以让我们访问完整的链表
last node 最后一个节点中的地址为 0 / NULL

P4 数组vs链表
which one is better?
the answer is not certain
1.访问某个元素所需成本: 数组更好
2.内存需求: 数组需要更大的内存空间来储存可能添加的元素, 链表则需要为指针分配内存空间
            数组所需空间连续, 可能需要重新盛名一个新数组并复制一个数组过去
3.插入或者删除元素的成本
4.谁更好用: 链表更容易出现错误
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值