File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ layout : post
3+ title : 資料結構- 佇列(Queue)
4+ date : 2020-02-09 21:05
5+ categories : [DataStructure, Queue]
6+ ---
7+
8+ ## 佇列
9+
10+ 佇列(Queue),具有先進先出(First In First Out)的特性,以生活上來舉例:在排隊的時候,服務人員一定是按照順序一位一位客人進行服務,服務完當下這位,才會對下一位客人進行服務。
11+
12+ 與堆疊處理資料的方式有點不太一樣,堆疊(Stack)的新增、彈出皆是在頂端(Top)做處理,但是` 佇列 ` 對於資料新增是在` 後端(Rear)進行插入 ` 操作,在` 前端進行刪除 `
13+
14+ ![ pic] ( https://i1.wp.com/www.fgchen.com/wp/wp-content/uploads/2016/12/120116_0009_Queue1.png?resize=460%2C221 )
15+
16+ ## 特性
17+
18+ - 具有` 先進先出(First In First Out) ` 的性質
19+
20+ - 直接於` 佇列後端(Rear)進行新增操作 ` ,故` 新增時間複雜度為O(1) `
21+
22+ - 直接於` 佇列前端(Front)進行移除操作 ` ,故` 刪除時間複雜度為O(1) `
23+
24+ - 搜尋時,需要從頭遍歷整個項目來搜索,故` 搜尋時間複雜度為O(n) ` ,
25+
26+
27+ 參考資料:
28+
29+ - [ 佇列] ( https://zh.wikipedia.org/wiki/%E9%98%9F%E5%88%97 )
30+
31+ - [ 資料結構的佇列(Queues)] ( http://wayne.cif.takming.edu.tw/datastru/queue.pdf )
32+
33+ - [ 佇列(Queue)] ( http://epaper.gotop.com.tw/pdf/AEE032400.pdf )
You can’t perform that action at this time.
0 commit comments