File tree 9 files changed +61
-11
lines changed 9 files changed +61
-11
lines changed Original file line number Diff line number Diff line change @@ -310,3 +310,4 @@ npm test -- 'playground'
310
310
- https://coolshell.cn/articles/4671.html
311
311
- https://www.cs.usfca.edu/~galles/visualization/Algorithms.html
312
312
- https://www.cs.usfca.edu/~galles/visualization/source.html
313
+ - [ 常用数据结构对比及其应用场景] ( https://www.jianshu.com/p/ec17d738327f )
Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ https://bost.ocks.org/mike/
27
27
Java程序员3面小米,被俩算法题难倒,微软员工6分钟解决,真丢脸
28
28
https://zhuanlan.zhihu.com/p/38850888
29
29
30
+ 各种算法题等
31
+ https://blog.csdn.net/v_JULY_v
32
+
30
33
31
34
为什么算法这么难? https://zhuanlan.zhihu.com/p/25101438
32
35
Original file line number Diff line number Diff line change @@ -32,3 +32,6 @@ HASH 主要用于信息安全领域中加密算法,它把一些不同长度的
32
32
- [ MD5] ( https://baike.baidu.com/item/MD5 )
33
33
- [ SHA家族] ( https://baike.baidu.com/item/SHA%E5%AE%B6%E6%97%8F/9849595 )
34
34
- [ npm: md5] ( https://www.npmjs.com/package/md5 )
35
+ - [ 常见hash算法的原理] ( http://www.cnblogs.com/zhoug2020/p/6984191.html )
36
+ - [ 转 从头到尾彻底解析Hash表算法] ( https://www.cnblogs.com/dancheblog/p/3512284.html )
37
+ - [ Hash 函数的常用算法和应用领域] ( http://www.cnblogs.com/qianxun/archive/2011/07/03/2096773.html )
Original file line number Diff line number Diff line change @@ -11,9 +11,26 @@ GUID(Globals Unique Identifiers 全局统一标识符)是微软对UUID这个
11
11
12
12
世界上的任何两台计算机都不会生成重复的 GUID 值。GUID 主要用于在拥有多个节点、多台计算机的网络或系统中,分配必须具有唯一性的标识符。在 Windows 平台上,GUID 应用非常广泛:注册表、类及接口标识、数据库、甚至自动生成的机器名、目录名等。一个GUID可以在后台数据库中操作一个主键。
13
13
14
+ ## 适用于分布式唯一标识码的生成算法有哪些?
15
+
16
+ - 利用数据库生成
17
+ - 利用Redis/MongoDB/zookeeper生成
18
+ - UUID
19
+ - UUID有基于MAC地址的,加上时间和时钟序列的,也有基于伪随机数的,基于加密哈希的。
20
+ - Twitter的snowflake算法
21
+ - Twitter开源,基于zk,41位时间戳(毫秒数)+10位机器的ID+12位毫秒内的流水号+1位符号位(永远是0)。
22
+ - 优点:性能不错,单机内递增。
23
+ - 缺点:依赖zk;依赖于机器时钟,分布式环境内可能会不是全局递增。
24
+ - 百度 UidGenerator
25
+ - UidGenerator是百度开源的分布式ID生成器,基于于snowflake算法的实现,看起来感觉还行。不过,国内开源的项目维护性真是担忧。
26
+ - 美团 Leaf
27
+ - Leaf 是美团开源的分布式ID生成器,能保证全局唯一性、趋势递增、单调递增、信息安全,里面也提到了几种分布式方案的对比,但也需要依赖关系数据库、Zookeeper等中间件。
28
+
14
29
参考资料:
15
30
16
31
- https://blog.csdn.net/forlong401/article/details/7580147
17
32
- https://blog.csdn.net/yuanlianming663/article/details/1842267
18
33
- https://www.cnblogs.com/pangguoming/p/7090906.html
19
34
- http://www.cnblogs.com/snandy/p/3261754.html
35
+ - https://m.zjurl.cn/answer/6640244087003808014/?iid=59688834959
36
+ - https://tech.meituan.com/2017/04/21/mt-leaf.html
Original file line number Diff line number Diff line change @@ -56,3 +56,4 @@ end Hash
56
56
57
57
- [ Wikipedia] ( https://en.wikipedia.org/wiki/Hash_table )
58
58
- [ YouTube] ( https://www.youtube.com/watch?v=shs0KM3wKv8&index=4&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8 )
59
+ - [ LinkedHashMap、HashMap比较] ( https://www.jianshu.com/p/979bc680b79f )
Original file line number Diff line number Diff line change @@ -234,16 +234,6 @@ export default class LinkedList {
234
234
return nodes ;
235
235
}
236
236
237
- /**
238
- * @param {*[] } values - Array of values that need to be converted to linked list.
239
- * @return {LinkedList }
240
- */
241
- fromArray ( values ) {
242
- values . forEach ( value => this . append ( value ) ) ;
243
-
244
- return this ;
245
- }
246
-
247
237
/**
248
238
* @param {function } [callback]
249
239
* @return {string }
Original file line number Diff line number Diff line change @@ -163,6 +163,12 @@ end ReverseTraversal
163
163
| :-------: | :-------: | :-------: | :-------: |
164
164
| O(n) | O(n) | O(1) | O(1) |
165
165
166
+ 这里删除的时间复杂度怎么会是 O(1) 呢,这里明明需要遍历,应该是O(n)
167
+
168
+ 如果已知需要删除的** 节点** ,那么可以使用以下方法优化到 O(1)
169
+
170
+ 参考:https://mp.weixin.qq.com/s/4Tg_NsXS8Z4DQPBIxwJplg
171
+
166
172
### 空间复杂度
167
173
168
174
O(n)
Original file line number Diff line number Diff line change 1
-
2
1
/* eslint no-var: 0, no-unused-vars: 0, prefer-const: 0 */
3
2
// number
4
3
var nine = 9 ;
Original file line number Diff line number Diff line change
1
+
2
+ /* eslint no-var: 0, no-unused-vars: 0, prefer-const: 0 */
3
+
4
+ // number
5
+ var nine = 9 ;
6
+
7
+ const three : number = 3 ;
8
+ let two : number = 2 ;
9
+
10
+ // boolean
11
+ const bool : boolean = false ;
12
+
13
+ // 命名名称必须有效,改为如下
14
+ const decThree : number = 3 ;
15
+ let decTwo : number = 2 ;
16
+ let testa : number = 2 ;
17
+
18
+ // boolean
19
+ let isDone : boolean = false ;
20
+
21
+ // string
22
+ const city : string = 'shanghai' ;
23
+
24
+ // null
25
+ let nul : null = null ;
26
+
27
+ // undefined
28
+ let empty ;
29
+
30
+ // let bigInter = 23142314231412345663451234n;
You can’t perform that action at this time.
0 commit comments