数据结构参考

2018-07-20  本文已影响0人  TRYao

1. 数组

Array

一个数组有序的组织元素,一个接一个放在内存中。
每一个数组都有一个从0开始的索引值index。

reference

优点:

缺点

2. 动态数组

Other names:
array list, growable array, resizable array, mutable array

Dynamic Array

动态数组相对于数组有了一个大的提升:自动调整大小。
数组的一个限制是固定大小,意味着你需要提前定义数组元素的数量。
动态数组可以随着你增加元素而扩大。所以你无需提前决定数组大小。

reference
优点:

Weaknesses:

2. 链表

Linked List

链表顺序地组织元素,每一个元素存储下一个元素的指针。
链表像一连串纸夹一样连在一起。它可以很快在顶部或底部再加一个纸夹。 It's even quick to insert one in the middle—just disconnect the chain at the middle link, add the new paperclip, then reconnect the other half.

An item in a linked list is called a node. The first node is called the head. The last node is called the tail.

Linked List

优点:

缺点:

上一篇下一篇

猜你喜欢

热点阅读