Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yjjnls committed Jan 14, 2018
1 parent 358d903 commit 7577649
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ median的难度在于**避免全排序的前提下**,在O(nlogn)时间内找
1. sort,time:O(nlogn)
2. 用heap或者multiset来排序,最后可以用next算法取第k个元素,单次取kth和solution1效果差不多。
3. 用两个priority_queue,取median时两个堆的元素最多相差1,而取kth时保持大顶堆(存放小元素)大小为k,小顶堆大小为(n-k)。适合与k比较小的情况。
4. quick select(divide and conquer),不断构造privot A[i],将lo和hi彼此靠拢,超找范围缩减至A[i]的某一侧,当i==k时,迭代停止。time:O(n^2) (215题)
4. quick select(divide and conquer),不断构造privot A[i],将lo和hi彼此靠拢,超找范围缩减至A[i]的某一侧,当i==k时,迭代停止。time:O(n^2) (215题) (好好看一看!!)
* * *
Expand Down
7 changes: 4 additions & 3 deletions src/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- [x] 50 pow(x,n) solution 3总是错误

- [ ] 4 median of two sorted arrays
查看第四题的kth element解法
查看第四题的kth element解法(和215题对比)
https://discuss.leetcode.com/topic/26926/another-simple-and-neat-solution-binary-search-non-recursion-3-rows-of-core-code-o-log-min-m-n/2
https://discuss.leetcode.com/topic/9898/share-my-simple-o-log-m-n-c-solution
!!!直接看215题总结
Expand Down Expand Up @@ -54,10 +54,11 @@ rpc
- [ ] brpc

分布式
- [ ] 分布式的书
- [ ] 一致哈希用于什么?优点是什么
- [x] 分布式的书
- [x] 一致哈希用于什么?优点是什么
- [ ] go 构建微服务技术栈
- [ ] 分布式session(6步达成基于zookeeper的分布式session实现)
- [ ] 各种分布式协议

Machine learning
- [ ] python实战+github库
Expand Down

0 comments on commit 7577649

Please sign in to comment.