# 單向鏈表 (Single Linked list) ## [鏈表操作指南](http://alrightchiu.github.io/SecondRound/linked-list-xin-zeng-zi-liao-shan-chu-zi-liao-fan-zhuan.html) ## 鏈表操作技巧 1. **前後指針** 創建兩個指針,一個在前一個在後,齊頭並進,直到後指針為None為止。 **題目:** | 題號 | 題目名稱 | | -------- | -------- | | 21 | [Merge two sorted lists](https://leetcode.cn/problems/merge-two-sorted-lists/)| 2. **快慢指針** 兩個指針,一個指針一次走一步,一個指針一次走兩步。 **題目:** | 題號 | 題目名稱 | | -------- | -------- | | 83 | [83. Remove duplicates from sorted list](https://leetcode.cn/problems/remove-duplicates-from-sorted-list/) | 3. **虛擬頭節點** 當鍊錶原來的頭節點可能會被改變的時候,我們往往會使用一個偽節點放在鍊錶的最前面,方便遍歷鍊錶、返回正確的結果。這個偽節點就是輔助頭節點。 什麼時候用輔助頭節點,什麼時候不用呢? 當頭結點可能被**反轉**、**刪除**、**改變**時,或者**頭節點不存在**(鍊錶為空)時,就需要使用輔助頭節點,便於返回正確的結果。 **題目:** | 題號 | 題目名稱 | | -------- | -------- | |19|[Remove nth node from end of lists](https://leetcode.cn/problems/remove-nth-node-from-end-of-list/)| |203|[Remove linked list elements](https://leetcode.cn/problems/remove-linked-list-elements/)| ## 參考資料 - [[LeetCode] 專題總結——鍊錶刷題指南](https://blog.csdn.net/Bertram03/article/details/88866456)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up