al
leetcode题解/算法笔记
1.
Part I - Basics
2.
Data Structure
2.1.
Linked List
2.2.
Binary Tree
2.3.
Binary Search Trees
2.4.
Huffman Compression
2.5.
Priority Queue
3.
Basics Sorting
3.1.
Bubble Sort
3.2.
Selection Sort
3.3.
Insertion Sort
3.4.
Merge Sort
3.5.
Quick Sort
3.6.
Heap Sort
3.7.
Bucket Sort
3.8.
Counting Sort
4.
Part II - Coding
5.
Search - 搜索
5.1.
Binary Search
5.2.
Search Insert Position
5.3.
Search for a Range
5.4.
First Bad Version
5.5.
Search a 2D Matrix
5.6.
Find Peak Element
5.7.
Search in Rotated Sorted Array
5.8.
Find Minimum in Rotated Sorted Array
6.
Sorted Array - 有序数组
6.1.
Remove Duplicates from Sorted Array
6.2.
Merge Sorted Array
6.3.
Median of two Sorted Arrays
7.
Reverse - 翻转法
7.1.
Recover Rotated Sorted Array
7.2.
Rotate String
7.3.
Reverse Words in a String
8.
String - 字符串
8.1.
Compare Strings
9.
Binary Tree - 二叉树
9.1.
Binary Tree Preorder Traversal
9.2.
Binary Tree Inorder Traversal
9.3.
Binary Tree Postorder Traversal
9.4.
Binary Tree Level Order Traversal
9.5.
Maximum Depth of Binary Tree
10.
Backtracking - 回溯法
10.1.
Subsets
10.2.
Permutation
11.
Linked List - 链表
11.1.
Remove Duplicates from Sorted List
11.2.
Reverse Linked List
11.3.
Merge Two Sorted Lists
11.4.
Partition List
11.5.
Remove Nth Node From End of List
12.
Dynamic Programming - 动态规划
12.1.
Triangle
12.2.
Knapsack - 背包问题
12.2.1.
Backpack
12.3.
Matrix
12.3.1.
Minimum Path Sum
12.3.2.
Unique Paths
12.4.
Sequence
12.4.1.
Climbing Stairs
12.4.2.
Jump Game
Powered by
GitBook
A
A
Serif
Sans
White
Sepia
Night
Share on Twitter
Share on Google
Share on Facebook
Share on Weibo
Share on Instapaper
al
Backtracking - 回溯法
回溯法包含了多类问题,模板类似。
排列组合模板->搜索问题(是否要排序,哪些情况要跳过)
使用回溯法的一般步骤:
确定所给问题的解空间:首先应明确定义问题的解空间,解空间中至少包含问题的一个解。
确定结点的扩展搜索规则
以深度优先方式搜索解空间,并在搜索过程中用剪枝函数避免无效搜索。
Reference
Steven Skiena: Lecture15 - Backtracking
全面解析回溯法:算法框架与问题求解 - 五岳 - 博客园
五大常用算法之四:回溯法 - 红脸书生 - 博客园
演算法筆記 - Backtracking