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
Bucket Sort
桶排序和归并排序有那么点点类似,也使用了归并的思想。大致步骤如下:
设置一个定量的数组当作空桶。
Divide - 从待排序数组中取出元素,将元素按照一定的规则塞进对应的桶子去。
对每个非空桶进行排序,通常可在塞元素入桶时进行插入排序。
Conquer - 从非空桶把元素再放回原来的数组中。
Reference
Bucket Sort Visualization
- 动态演示。
桶排序 - 维基百科,自由的百科全书