diff --git a/docs/DataStructure/Collection-of-common-algorithms.md b/docs/DataStructure/Collection-of-common-algorithms.md index 3051972e..b1711518 100644 --- a/docs/DataStructure/Collection-of-common-algorithms.md +++ b/docs/DataStructure/Collection-of-common-algorithms.md @@ -416,7 +416,7 @@ var hasCycle = function (head) { [leetcode](https://leetcode-cn.com/problems/linked-list-cycle-ii/) 分析 1:快慢指针法。和上一题的方法一样,从链表头开始,快指针每次走两步,慢指针每次走一步。 -![](/image/linked_list_sycle.png) +![](/blog/imgs/algorithm/linked_list_sycle.png) D:头节点到入环点的距离 S1:从入环点到首次相遇点的距离 S2:从首次相遇点到入环点的距离 diff --git a/docs/DataStructure/Graph.md b/docs/DataStructure/Graph.md index c66c6bfc..a27d1ebd 100644 --- a/docs/DataStructure/Graph.md +++ b/docs/DataStructure/Graph.md @@ -20,15 +20,15 @@ order: 7 在图中,有**无向图**与**有向图**之分,如果边有方向的话,就是有向图,反之则为无向图。 -
![无向图](/image/graph/first.png)
+![无向图](/blog/imgs/graph/first.png) -
![无向图](/image/graph/second.png)
+![无向图](/blog/imgs/graph/second.png) 在无向图中,有度的概念,表示为一个顶点有多少条边。在有向图中,会把度分为**入度**和**出度**。入度表示有多少边指向这个顶点;出度表示有多少条边是以这个顶点为起点指向其他顶点。 还有一种图,叫做**带权图**,在带权图中每条边都有一个权重。 -
![无向图](/image/graph/three.png)
+![无向图](/blog/imgs/graph/three.png) #### 存储方法 @@ -37,7 +37,7 @@ order: 7 图的最直观一种存储方式就是邻接矩阵。 邻接矩阵的底层是一个二维数组。对于无向图来说,如果顶点 i 和顶点 j 之间有边,就把 A[i][j]和 A[j][i]标记为 1;对于有向图来说,如果顶点 i 到顶点 j 之间,有一条箭头从顶点 i 指向顶点 j 的边,就把 A[i][j]标记为 1;对于带权图来说,数组中对应的存储相应的权重。 -
![无向图](/image/graph/array.png)
+![无向图](/blog/imgs/graph/array.png) 虽然这种存储方式简单、直观,但是比较浪费存储空间。尤其是对于无向图来说,A[i][j]为 1 的话,那么 A[j][i]也为 1。实际上,只需要存储一个就行了,等用于浪费了一般的存储空间。 @@ -45,7 +45,7 @@ order: 7 在表示上,邻接表看起来有点像散列表。每个顶点,都对应了一条链表,链表中存储的是这个顶点与相连接的其他顶点。 -
![邻接表](/image/graph/list.png)
+![邻接表](/blog/imgs/graph/list.png) ### 构建图 @@ -94,7 +94,7 @@ class Graph { 这一段代码就已经将图类创建好了,如图: -
![邻接表](/image/graph/search.png)
+![邻接表](/blog/imgs/graph/search.png) 为了直观的将邻接表展示出来,我们为 Graph 添加 toString 方法,能够展示出与每个顶点连接的其他的顶点。 @@ -156,7 +156,7 @@ __initializeColor() { 针对于上图,以'A'做为第一个访问顶点,它的访问顺序就是下图所展示的: -
![示意图](/image/graph/bfs.png)
+![示意图](/blog/imgs/graph/bfs.png) 代码实现: @@ -190,7 +190,7 @@ bfs(v, cb) { 针对于上图,以'A'做为第一个访问顶点,它的访问顺序就是下图所展示的: -
![示意图](/image/graph/dfs.png)
+![示意图](/blog/imgs/graph/dfs.png) 代码实现: diff --git a/docs/DataStructure/LinkedList-problem-solving-ideas.md b/docs/DataStructure/LinkedList-problem-solving-ideas.md index 98ff7f23..796e3ebf 100644 --- a/docs/DataStructure/LinkedList-problem-solving-ideas.md +++ b/docs/DataStructure/LinkedList-problem-solving-ideas.md @@ -656,7 +656,7 @@ var hasCycle = function (head) { [leetcode](https://leetcode-cn.com/problems/linked-list-cycle-ii/) 分析 1:快慢指针法。和上一题的方法一样,从链表头开始,快指针每次走两步,慢指针每次走一步。 -![](/image/linked_list_sycle.png) +![](/blog/imgs/algorithm/linked_list_sycle.png) D:头节点到入环点的距离 S1:从入环点到首次相遇点的距离 S2:从首次相遇点到入环点的距离 diff --git a/docs/DataStructure/NodeTree.md b/docs/DataStructure/NodeTree.md index bb0ceea1..c9232bd2 100644 --- a/docs/DataStructure/NodeTree.md +++ b/docs/DataStructure/NodeTree.md @@ -28,13 +28,13 @@ order: 6 - 高度(height):节点到叶子节点的最长路径 - 深度(depth):根节点到这个节点所经历的边的个数 - 层(level):节点的深度+1 -
![普通二叉树](/image/tree/tree_height.png)
+ ![普通二叉树](/blog/imgs/tree/tree_height.png) ## 二叉树 在上面我们提到,二叉树就是每个节点最多含有两个子树。 -
![普通二叉树](/image/tree/binary_tree.png)
+![普通二叉树](/blog/imgs/tree/binary_tree.png) ### 关于递归 @@ -89,14 +89,14 @@ function traverse(root) { 这是一种基于指针或者引用的二叉链式存储法。这是一种常用的方式。 每个节点有三个字段,其中一个存储数据,另外两个是指向左右子节点的指针。 -
![普通二叉树](/image/tree/tree_linked.png)
+![普通二叉树](/blog/imgs/tree/tree_linked.png) ##### 顺序存储法 这是一种基于数组的顺序存储法。 我们把根节点存储在下标 i = 1 的位置,那左子节点存储在下标 2 \* i = 2 的位置,右子节点存储在 2 \* i + 1 = 3 的位置,以此类推。 -
![普通二叉树](/image/tree/tree_array.png)
+![普通二叉树](/blog/imgs/tree/tree_array.png) 所以某棵二叉树是一棵完全二叉树的时候,用数组存储是最节省内存的一种方式。 @@ -184,7 +184,7 @@ function levelOrder() { - 其左子树(left subtree)下的每个后代节点(descendant node)的值都小于节点 n 的值; - 其右子树(right subtree)下的每个后代节点的值都大于节点 n 的值。 -
![普通二叉树](/image/tree/binary_search_tree.png)
+![普通二叉树](/blog/imgs/tree/binary_search_tree.png) #### 二叉查找树的构建 diff --git a/docs/Engineering/Pnpm-package-management-that-I-know.md b/docs/Engineering/Pnpm-package-management-that-I-know.md index e1f90d26..3bb6252b 100644 --- a/docs/Engineering/Pnpm-package-management-that-I-know.md +++ b/docs/Engineering/Pnpm-package-management-that-I-know.md @@ -202,7 +202,7 @@ order: 0 能够发现,这次是`base64-js@ 1.5.1`被提取到了根目录下的 node_modules 下,buffer 的 base64-js 能够和它兼容,所以 buffer 的 node_modules 下不再存在依赖,然而 bops 依赖的 base64-js 不兼容,所以会挂在自身的 node_modules 下 -
💡 子依赖项的依赖不兼容的情况下,底层会通过[localeCompare](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)的方法对依赖进行一个排序,字典序靠前的 npm 包的**底层依赖**会优先被提取出来,放到根目录下的 node_modules 中,之后如果发现不兼容的依赖,则继续采用 npm 2 的处理方式,都会放在自身的 node_modules 下
+
💡 子依赖项的依赖不兼容的情况下,底层会通过 localeCompare 的方法对依赖进行一个排序,字典序靠前的 npm 包的**底层依赖**会优先被提取出来,放到根目录下的 node_modules 中,之后如果发现不兼容的依赖,则继续采用 npm 2 的处理方式,都会放在自身的 node_modules 下
❓ 通过上面这几个例子,能够发现 npm3 在解决了一些问题的同时,也带来新的问题。 diff --git a/public/imgs/algorithm/linked_list_sycle.png b/public/imgs/algorithm/linked_list_sycle.png new file mode 100644 index 00000000..447ee10d Binary files /dev/null and b/public/imgs/algorithm/linked_list_sycle.png differ diff --git a/public/imgs/graph/array.png b/public/imgs/graph/array.png new file mode 100644 index 00000000..d1b87841 Binary files /dev/null and b/public/imgs/graph/array.png differ diff --git a/public/imgs/graph/bfs.png b/public/imgs/graph/bfs.png new file mode 100644 index 00000000..447d1542 Binary files /dev/null and b/public/imgs/graph/bfs.png differ diff --git a/public/imgs/graph/dfs.png b/public/imgs/graph/dfs.png new file mode 100644 index 00000000..fb1428a9 Binary files /dev/null and b/public/imgs/graph/dfs.png differ diff --git a/public/imgs/graph/first.png b/public/imgs/graph/first.png new file mode 100644 index 00000000..9beacbb2 Binary files /dev/null and b/public/imgs/graph/first.png differ diff --git a/public/imgs/graph/list.png b/public/imgs/graph/list.png new file mode 100644 index 00000000..32a242ad Binary files /dev/null and b/public/imgs/graph/list.png differ diff --git a/public/imgs/graph/search.png b/public/imgs/graph/search.png new file mode 100644 index 00000000..6a54340e Binary files /dev/null and b/public/imgs/graph/search.png differ diff --git a/public/imgs/graph/second.png b/public/imgs/graph/second.png new file mode 100644 index 00000000..e5d33a46 Binary files /dev/null and b/public/imgs/graph/second.png differ diff --git a/public/imgs/graph/three.png b/public/imgs/graph/three.png new file mode 100644 index 00000000..981ea0d2 Binary files /dev/null and b/public/imgs/graph/three.png differ diff --git a/public/imgs/tree/binary_search_tree.png b/public/imgs/tree/binary_search_tree.png new file mode 100644 index 00000000..d7ca38dd Binary files /dev/null and b/public/imgs/tree/binary_search_tree.png differ diff --git a/public/imgs/tree/binary_tree.png b/public/imgs/tree/binary_tree.png new file mode 100644 index 00000000..34d71b88 Binary files /dev/null and b/public/imgs/tree/binary_tree.png differ diff --git a/public/imgs/tree/gragh.png b/public/imgs/tree/gragh.png new file mode 100644 index 00000000..9e10fc81 Binary files /dev/null and b/public/imgs/tree/gragh.png differ diff --git a/public/imgs/tree/tree_array.png b/public/imgs/tree/tree_array.png new file mode 100644 index 00000000..1095af78 Binary files /dev/null and b/public/imgs/tree/tree_array.png differ diff --git a/public/imgs/tree/tree_height.png b/public/imgs/tree/tree_height.png new file mode 100644 index 00000000..16ac01ab Binary files /dev/null and b/public/imgs/tree/tree_height.png differ diff --git a/public/imgs/tree/tree_linked.png b/public/imgs/tree/tree_linked.png new file mode 100644 index 00000000..d1595aa0 Binary files /dev/null and b/public/imgs/tree/tree_linked.png differ