You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Algorithm/algorithm-en.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Shift arithmetic left is to move all the binary to the left, `10` is represented
31
31
10>>1// -> 5
32
32
```
33
33
34
-
The right shift of the arithmetic is to move all the binary to the right and remove the extra right. `10` is represented as `1010` in binary, and becomes `101` after shifting one bit to the right, and converted to decimal is 5, so the right shift is seen as the following formula `a >> b => a / (2 ^ b)` by basically.
34
+
The bitwise right shift moves all the binary digits to the right and remove the extra left digit. `10` is represented as `1010` in binary, and becomes `101` after shifting one bit to the right, and becomes 5 in decimal value, so the right shift is basically the following formula:`a >> b => a / (2 ^ b)`.
35
35
36
36
Right shift is very useful, for example, you can calculate the intermediate value in the binary algorithm.
37
37
@@ -66,8 +66,8 @@ Each bit is different, and the result is 1
66
66
```js
67
67
8^7// -> 15
68
68
8^8// -> 0
69
-
// 1000 & 0111 -> 1111 -> 15
70
-
// 1000 & 1000 -> 0000 -> 0
69
+
// 1000 ^ 0111 -> 1111 -> 15
70
+
// 1000 ^ 1000 -> 0000 -> 0
71
71
```
72
72
73
73
From the above code, we can find that the bitwise XOR is the not carry addition.
@@ -863,4 +863,4 @@ In the string correlation algorithm, Trie tree can solve many problems, and has
863
863
- Word frequency statistics
864
864
- Prefix matching
865
865
866
-
If you don't know much about the Trie tree, you can go [here](../DataStruct/dataStruct-zh.md#trie) to read
866
+
If you don't know much about the Trie tree, you can go [here](../DataStruct/dataStruct-zh.md#trie) to read
Copy file name to clipboardExpand all lines: Framework/framework-en.md
+20-20
Original file line number
Diff line number
Diff line change
@@ -294,12 +294,12 @@ ul.childNodes[2].remove()
294
294
let fromNode =ul.childNodes[4]
295
295
let toNode =node.childNodes[3]
296
296
let cloneFromNode =fromNode.cloneNode(true)
297
-
letcloenToNode=toNode.cloneNode(true)
297
+
letcloneToNode=toNode.cloneNode(true)
298
298
ul.replaceChild(cloneFromNode, toNode)
299
-
ul.replaceChild(cloenToNode, fromNode)
299
+
ul.replaceChild(cloneToNode, fromNode)
300
300
```
301
301
302
-
Of course, in actual operations, we need an indentifier for each node, as an index for checking if two nodes are identical. This is why both Vue and React's official documentation suggests using a unique identifier `key` for nodes in a list to ensure efficiency.
302
+
Of course, in actual operations, we need an identifier for each node, as an index for checking if two nodes are identical. This is why both Vue and React's official documentation suggests using a unique identifier `key` for nodes in a list to ensure efficiency.
303
303
304
304
DOM element can not only be simulated, but they can also be rendered by JS objects.
305
305
@@ -393,7 +393,7 @@ We then have two steps of the algorithm.
393
393
394
394
First let's implement the recursion algorithm of the tree. Before doing that, let's consider the different cases of comparing two nodes.
395
395
396
-
1. new nodes's `tagName` or `key` is different from that of the old one. This menas the old node is replaced, and we don't have to recurse on the node any more because the whole subtree is removed.
396
+
1. new node's `tagName` or `key` is different from that of the old one. This means the old node is replaced, and we don't have to recurse on the node any more because the whole subtree is removed.
397
397
2. new node's `tagName` and `key` (maybe nonexistent) are the same as the old's. We start recursing on the subtree.
398
398
3. no new node appears. No operation needed.
399
399
@@ -403,10 +403,10 @@ import Element from './element'
0 commit comments