
algorithm
文章平均质量分 81
C站小学生
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Ramdon Shuffle
Random ShuffleShuffle SortLinear ShuffleAlgorithmProofA Common MistakeRandom ShuffleGoal. Rearrange array so that result is a uniformly random permutation. (洗牌算法)Shuffle Sort使用排序算法来shuffle:Gener原创 2015-07-09 16:51:55 · 813 阅读 · 1 评论 -
Random Sample - Reservoir
Problem给出一串元素流,设长度为nn,nn可以是未知或是无限的。从中随机抽取ss个样本,要求在任何n=k,k≥sn=k, k \ge s的时刻,kk中任何一个大小为ss的子集被选中的概率都相同。 Randomly select ss items from a set RR of size n>sn > s, where nn is unknown, such that each membe原创 2015-07-14 11:15:42 · 424 阅读 · 0 评论 -
解题思路
3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters f原创 2015-07-18 15:22:09 · 516 阅读 · 0 评论 -
Inorder Traversal a BST with Constant Extra Space
1. Modify the BST During the Traversal出自: http://stackoverflow.com/questions/5496464/write-a-non-recursive-traversal-of-a-binary-search-tree-using-constant-space-andUse O(n) time and canstant space.Id原创 2015-07-31 01:10:41 · 663 阅读 · 0 评论 -
KMP实现
代码Version 1/*The length of p(attern) is len, the length of next array is (len+1).*/void preKMP_one(char *p, int *next, int len){ int i = 0, j = -1; next[0] = -1; while (i < len){原创 2015-09-11 17:00:24 · 452 阅读 · 0 评论