---
# System prepended metadata

title: 排序演算法筆記
tags: [Algorithm]

---

# 排序演算法筆記
###### tags: `Algorithm`

### Heap sort 時間複雜度為O(nlogn)原因
http://notepad.yehyeh.net/Content/Algorithm/Sort/Heap/Heap.php

### Quick sort 複雜度為O(n^2) 但可優化
1. https://kopu.chat/2017/08/03/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F-quick-sort/
2. https://rust-algo.club/sorting/quicksort/index.html
### Merge sort 時間複雜度為O(nlogn)原因
![](https://i.imgur.com/DFuUVge.png)
![](https://i.imgur.com/0S4BfYz.png)
https://medium.com/appworks-school/%E5%88%9D%E5%AD%B8%E8%80%85%E5%AD%B8%E6%BC%94%E7%AE%97%E6%B3%95-%E6%8E%92%E5%BA%8F%E6%B3%95%E9%80%B2%E9%9A%8E-%E5%90%88%E4%BD%B5%E6%8E%92%E5%BA%8F%E6%B3%95-6252651c6f7e

### insertion sort and selection sort 時間複雜度為 O(n^2)原因
https://medium.com/appworks-school/%E5%88%9D%E5%AD%B8%E8%80%85%E5%AD%B8%E6%BC%94%E7%AE%97%E6%B3%95-%E6%8E%92%E5%BA%8F%E6%B3%95%E5%85%A5%E9%96%80-%E9%81%B8%E6%93%87%E6%8E%92%E5%BA%8F%E8%88%87%E6%8F%92%E5%85%A5%E6%8E%92%E5%BA%8F%E6%B3%95-23d4bc7085ff

### 注意:
![](https://i.imgur.com/sCi5aM0.png)
