status
date
slug
tags
category
type
password
icon
本文目錄
前言經典單鍊表LeetCode 021. Merge Two Sorted ListsLeetCode 086. Partition ListLeetCode 23. Merge k Sorted ListsLeetCode 019. Remove Nth Node From End of ListLeetCode 876. Middle of the Linked ListLeetCode 141. Linked List CycleLeetCode 142. Linked List Cycle IILeetCode 160. Intersection of Two Linked ListsLeetCode 109. Convert Sorted List to Binary Search TreeLeetCode 83. Remove Duplicates from Sorted List反轉鍊表反轉鍊表模板反轉前 N 個節點LeetCode 92. Reverse Linked List IILeetCode 25. Reverse Nodes in k-GroupLeetCode 234. Palindrome Linked ListLeetCode LeetCode LeetCode
前言
經典單鍊表
LeetCode 021. Merge Two Sorted Lists
- Dummy Node 的運用
LeetCode 086. Partition List
- 當舊鏈表的節點被指派到新鏈表時 ⇒ 斷開舊鏈表的連接
LeetCode 23. Merge k Sorted Lists
- 自定義 Priority Queue 的比較函式
LeetCode 019. Remove Nth Node From End of List
- 快慢指標
LeetCode 876. Middle of the Linked List
LeetCode 141. Linked List Cycle
- 判斷鏈表中是否有環 ⇒ 快慢指標相遇即有環存在
LeetCode 142. Linked List Cycle II
- 找出鏈表中環的起點 ⇒ 快慢指標相遇後,再將任意指標指回頭節點,同速並行直到相遇的節點即環的起點
LeetCode 160. Intersection of Two Linked Lists
- 找到兩條鍊表的交點 ⇒ 兩個指標分別走過 ,相等時所在節點即交點
LeetCode 109. Convert Sorted List to Binary Search Tree
- 構造 BST
LeetCode 83. Remove Duplicates from Sorted List
反轉鍊表
反轉鍊表模板
反轉前 N 個節點
LeetCode 92. Reverse Linked List II
LeetCode 25. Reverse Nodes in k-Group
LeetCode 234. Palindrome Linked List
- 快慢指標判斷鍊表中點時,若是鍊表長度為奇數,慢指標需要多前進一格。
LeetCode
LeetCode
LeetCode
- Author:Zixu
- URL:https://zixu.us.kg/article/鏈表_隨筆
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!