Comparing Data Structures.pdf

Comparing Data Structures.pdf

ID:33862224

大小:817.01 KB

页数:7页

时间:2019-02-28

Comparing Data Structures.pdf_第1页
Comparing Data Structures.pdf_第2页
Comparing Data Structures.pdf_第3页
Comparing Data Structures.pdf_第4页
Comparing Data Structures.pdf_第5页
资源描述:

《Comparing Data Structures.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、Comparing Data StructuresExamples Data Structures Efficiency Get‐by‐Data Structure Add Find Delete index Array (T[])O(n)O(n) O(n) O(1) Linked list O(1)O(n) O(n) O(n) (LinkedList) Resizable array list O(1)O(n) O(n) O(1) (List)Stack (Stack)O(1)‐ O(1) ‐ Queue (Queue)O(1)‐ O(1) ‐

2、 2 Data Structures Efficiency (2)Get‐by‐Data Structure Add Find Delete index Hash table O(1)O(1)O(1)‐ (Dictionary)Tree‐based dic@onary (Sorted O(logn)O(logn)O(logn)‐ Dictionary)Hash table based set O(1)O(1) O(1) ‐ (HashSet) Tree based set O(logn)O(logn)O(logn)‐ (SortedSet

3、) 3 Choosing Data Structure •Arrays (T[]) –Use when fixed number of elements should be processed by index •Resizable array lists (List) –Use when elements should be added and processed by index •Linked lists (LinkedList) –Use when elements should be added at the both sides of the 

4、list –Otherwise use resizable array list (List) 4 Choosing Data Structure (2) •Stacks (Stack) –Use to implement LIFO (last‐in‐first‐out) behavior –List could also work well•Queues (Queue) –Use to implement FIFO (first‐in‐first‐out) behavior –LinkedList could also work well 

5、•Hash table based dicOonary (Dictionary) –Use when key‐value pairs should be added fast and searched fast by key –Elements in a hash table have no parOcular order 5 Choosing Data Structure (3) •Balanced search tree based dicOonary (SortedDictionary) –Use when key‐value pairs 

6、should be added fast, searched fast by key and enumerated sorted by key •Hash table based set (HashSet) –Use to keep a group of unique values, to add and check belonging to the set fast –Elements are in no parOcular order •Search tree based set (SortedSet) –Use to keep a group of

7、 ordered unique values 6 Summary•Algorithm complexity is rough esOmaOon of the number of steps performed by given computaOon –Complexity can be logarithmic, linear, n log n, square, cubic, exponenOal, etc. –Allows to esOmaOng the speed of given code before its execuOon •Different data

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。