Skip to content

Commit 02a61d3

Browse files
committed
auto commit
1 parent 3a604c2 commit 02a61d3

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

notes/Java 容器.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ List list = Arrays.asList(arr);
100100
也可以使用以下方式调用 asList():
101101

102102
```java
103-
List list = Arrays.asList(1,2,3);
103+
List list = Arrays.asList(1, 2, 3);
104104
```
105105

106106
# 三、源码分析
@@ -575,7 +575,7 @@ int hash = hash(key);
575575
int i = indexFor(hash, table.length);
576576
```
577577

578-
(一)计算 hash 值
578+
**4.1 计算 hash 值**
579579

580580
```java
581581
final int hash(Object k) {
@@ -600,7 +600,7 @@ public final int hashCode() {
600600
}
601601
```
602602

603-
(二)取模
603+
**4.2 取模**
604604

605605
令 x = 1<<4,即 x 为 2 的 4 次方,它具有以下性质:
606606

@@ -727,7 +727,7 @@ new capacity : 00100000
727727

728728
对于一个 Key,
729729

730-
- 它的哈希值如果在第 5 位上为 0,那么取模得到的结果和之前一样;
730+
- 它的哈希值如果在第 6 位上为 0,那么取模得到的结果和之前一样;
731731
- 如果为 1,那么得到的结果为原来的结果 +16。
732732

733733
### 7. 扩容-计算数组容量

notes/Leetcode 题解.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,7 @@ return ret;
27812781
定义一个 tails 数组,其中 tails[i] 存储长度为 i + 1 的最长递增子序列的最后一个元素。对于一个元素 x,
27822782

27832783
- 如果它大于 tails 数组所有的值,那么把它添加到 tails 后面,表示最长递增子序列长度加 1;
2784-
- 如果 tails[i-1] < x <= tails[i],那么更新 tails[i-1] = x。
2784+
- 如果 tails[i-1] < x <= tails[i],那么更新 tails[i] = x。
27852785

27862786
例如对于数组 [4,3,6,5],有:
27872787

notes/剑指 offer 题解.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ Output:
223223

224224
在字符串尾部填充任意字符,使得字符串的长度等于替换之后的长度。因为一个空格要替换成三个字符(%20),因此当遍历到一个空格时,需要在尾部填充两个任意字符。
225225

226-
令 P1 指向字符串原来的末尾位置,P2 指向字符串现在的末尾位置。P1 和 P2从后向前遍历,当 P1 遍历到一个空格时,就需要令 P2 指向的位置依次填充 02%(注意是逆序的),否则就填充上 P1 指向字符的值。
226+
令 P1 指向字符串原来的末尾位置,P2 指向字符串现在的末尾位置。P1 和 P2 从后向前遍历,当 P1 遍历到一个空格时,就需要令 P2 指向的位置依次填充 02%(注意是逆序的),否则就填充上 P1 指向字符的值。
227227

228228
从后向前遍是为了在改变 P2 所指向的内容时,不会影响到 P1 遍历原来字符串的内容。
229229

230230
```java
231231
public String replaceSpace(StringBuffer str) {
232232
int P1 = str.length() - 1;
233-
for (int i = 0; i < P1 + 1; i++)
233+
for (int i = 0; i <= P1; i++)
234234
if (str.charAt(i) == ' ')
235235
str.append(" ");
236236

@@ -385,6 +385,7 @@ private TreeNode reConstructBinaryTree(int[] pre, int preL, int preR, int inL) {
385385

386386
```java
387387
public class TreeLinkNode {
388+
388389
int val;
389390
TreeLinkNode left = null;
390391
TreeLinkNode right = null;
@@ -510,6 +511,7 @@ public int Fibonacci(int n) {
510511

511512
```java
512513
public class Solution {
514+
513515
private int[] fib = new int[40];
514516

515517
public Solution() {
@@ -956,7 +958,7 @@ private void printNumber(char[] number) {
956958

957959
```java
958960
public ListNode deleteNode(ListNode head, ListNode tobeDelete) {
959-
if (head == null || head.next == null || tobeDelete == null)
961+
if (head == null || tobeDelete == null)
960962
return null;
961963
if (tobeDelete.next != null) {
962964
// 要删除的节点不是尾节点

0 commit comments

Comments
 (0)